### Question:
ColumnFamilyTemplate extends AbstractColumnFamilyTemplate<K,N,V> implements ColumnFamilyOperations<K,N,V> { @Override public V readColumnValue(K rowKey, N columnName) { ColumnQuery<K,N,V> query = HFactory.createColumnQuery(getKeyspace(), getKeySerializer(), getColumnNameSerializer(), getValueSerializer()); QueryResult<HColumn<N,V>> result = query. setKey(rowKey). setColumnFamily(getColumnFamily()). setName(columnName). execute(); HColumn<N,V> column = result.get(); return column != null ? column.getValue() : null; } ColumnFamilyTemplate(Keyspace keyspace,
                                Serializer<K> keySerializer,
                                Serializer<N> columnNameSerializer,
                                Serializer<V> valueSerializer);  ColumnFamilyTemplate(Keyspace keyspace,
                                @Nullable String defaultColumnFamily,
                                Serializer<K> keySerializer,
                                Serializer<N> columnNameSerializer,
                                Serializer<V> valueSerializer); @Override V readColumnValue(K rowKey, N columnName); @Override Map<N,V> readColumnsAsMap(K rowKey); @Override Map<N,V> readColumnsAsMap(K rowKey, N start, N finish, int count, boolean reversed); @Override List<T> readColumns(K rowKey, ColumnMapper <T,N,V> columnMapper); @Override List<T> readColumns(K rowKey,
                                   N start,
                                   N finish,
                                   int count,
                                   boolean reversed,
                                   ColumnMapper<T,N,V> columnMapper); @Override Map<K,Map<N,V>> multiGetAsMap(Iterable<K> rowKeys); @Override Map<K,Map<N,V>> multiGetColumnsAsMap(Iterable<K> rowKeys, N... columnNames); @Override Map<K,Map<N,V>> readRowsAsMap(); @Override List<T> multiGet(Iterable<K> rowKeys, ColumnFamilyRowMapper<T,K,N,V> rowMapper); @Override List<T> multiGetColumns(Iterable<K> rowKeys, ColumnFamilyRowMapper<T,K,N,V> rowMapper,
                                       N... columnNames); @Override void writeColumn(K rowKey, N columnName, V columnValue); @Override void writeColumn(K rowKey, N columnName, V columnValue, long timeToLive, TimeUnit timeToLiveTimeUnit); @Override void writeColumn(K rowKey, N columnName, V columnValue, @Nonnull BatchContext batchContext); @Override void writeColumn(K rowKey,
                            N columnName,
                            V columnValue,
                            int timeToLive,
                            TimeUnit timeToLiveTimeUnit,
                            @Nonnull BatchContext batchContext); @Override void writeColumns(K rowKey, Map<N,V> map); @Override void writeColumns(K rowKey, Map<N,V> map, @Nonnull BatchContext batchContext); @Override void deleteColumns(K rowKey, N... columnNames); @Override void deleteColumns(K rowKey, N start, N finish); @Override void deleteColumns(K rowKey, N start, N finish, @Nullable BatchContext batchContext);  }### Answer:
@Test(groups = {"unit"}) public void testReadColumnValue() throws Exception { HColumn<String,String> column = mock(HColumn.class); String columnValue = "testColumnValue"; when(column.getValue()).thenReturn(columnValue); when(executionResult.get()).thenReturn(column); String value = columnFamilyTestDao.readColumnValue(rowKey, columnName); assertEquals(value, columnValue); }
@Test(groups = {"unit"}, expectedExceptions = HectorTransportException.class) public void testReadColumnValueTranslateHectorException() throws Exception { when(executionResult.get()).thenThrow(new HectorTransportException("test hector exception")); columnFamilyTestDao.readColumnValue(rowKey, columnName); }