### Question:
CqlUtils { public static List<Object> toList(TupleValue tuple) { List<DataType> componentTypes = tuple.getType().getComponentTypes(); List<Object> results = new ArrayList<>(componentTypes.size()); int index = 0; for (DataType dataType : componentTypes) { results.add(getValue(tuple, index++, dataType)); } return results; } private  CqlUtils(); static BoundStatement bind(PreparedStatement statement, Object[] params); static Object getValue(GettableByIndexData gettable, int columnIndex, DataType dataType); static List<Object> toList(TupleValue tuple); static List<Object> toList(Row row); static final Logger CQL_LOGGER; }### Answer:
@Test public void testGetNullValue() { List<Object> values = CqlUtils.toList(getSession().execute(select("null_col").from("test_table")).one()); assertEquals(1, values.size()); assertNull(values.get(0)); }
@Test public void testTupleValueToList() { TupleType tupleType = TupleType.of( DataType.varchar(), DataType.cboolean(), DataType.cint(), DataType.cfloat(), DataType.cdouble()); TupleValue tupleValue = tupleType.newValue("foo", false, 123, 123.456f, 234.567); List<Object> values = CqlUtils.toList(tupleValue); assertEquals(Lists.newArrayList("foo", false, 123, 123.456f, 234.567), values); }
@Test(expected = HecateException.class) public void testGetValueInvalidType() { withSession(session -> { session.execute("update counter_table set counter_value = counter_value + 1 where id = '1'"); ResultSet rs = session.execute("select * from counter_table"); CqlUtils.toList(rs.one()); }); }