### Question:
ValueUtil { public static List<String> stringColumnOf(VTable table, String columnName) { if (columnName == null) { return null; } for (int i = 0; i < table.getColumnCount(); i++) { if (columnName.equals(table.getColumnName(i))) { if (table.getColumnType(i).equals(String.class)) { @SuppressWarnings("unchecked") List<String> result = (List<String>) table.getColumnData(i); return result; } else { throw new IllegalArgumentException("Column '" + columnName +"' is not string (contains " + table.getColumnType(i).getSimpleName() + ")"); } } } throw new IllegalArgumentException("Column '" + columnName +"' was not found"); } private  ValueUtil(); static Class<?> typeOf(Object obj); static Alarm alarmOf(Object obj); static Alarm alarmOf(Object value, boolean connected); static Alarm highestSeverityOf(final List<Object> args, final boolean considerNull); static Time latestTimeOf(final List<Object> args); static Time latestValidTimeOrNowOf(final List<Object> args); static Time timeOf(Object obj); static Display displayOf(Object obj); static boolean displayHasValidDisplayLimits(Display display); static Double normalizedNumericValueOf(Object obj); static Double normalize(Number value, Display display); static Double normalize(Number value, Number lowValue, Number highValue); static Double numericValueOf(Object obj); static BufferedImage toImage(VImage vImage); static VImage toVImage(BufferedImage image); static boolean displayEquals(Display d1, Display d2); static void setAlarmSeverityColorMap(Map<AlarmSeverity, Integer> map); static int colorFor(AlarmSeverity severity); static DateTimeFormatter getDefaultTimestampFormat(); static void setDefaultTimestampFormat(DateTimeFormatter defaultTimestampFormat); static NumberFormat getDefaultNumberFormat(); static void setDefaultNumberFormat(NumberFormat defaultNumberFormat); static ValueFormat getDefaultValueFormat(); static void setDefaultValueFormat(ValueFormat defaultValueFormat); static ListNumber numericColumnOf(VTable table, String columnName); static List<String> stringColumnOf(VTable table, String columnName); static List<ArrayDimensionDisplay> defaultArrayDisplay(VNumberArray array); static List<ArrayDimensionDisplay> defaultArrayDisplay(ListInt sizes); static VNumberArray subArray(VNumberArray array, int index);  }### Answer:
@Test public void stringColumnOf1() { VTable data = ValueFactory.newVTable(Arrays.<Class<?>>asList(String.class, String.class), Arrays.asList("x", "y"), Arrays.<Object>asList(Arrays.asList("1", "2", "3"), Arrays.asList("a", "b", "c"))); assertThat(ValueUtil.stringColumnOf(data, null), equalTo(null)); assertThat(ValueUtil.stringColumnOf(data, "x"), equalTo(Arrays.asList("1", "2", "3"))); assertThat(ValueUtil.stringColumnOf(data, "y"), equalTo(Arrays.asList("a", "b", "c"))); }
@Test(expected = IllegalArgumentException.class) public void stringColumnOf2() { VTable data = ValueFactory.newVTable(Arrays.<Class<?>>asList(double.class, String.class), Arrays.asList("x", "y"), Arrays.<Object>asList(new ArrayDouble(1,2,3), Arrays.asList("a", "b", "c"))); assertThat(ValueUtil.stringColumnOf(data, null), equalTo(null)); assertThat(ValueUtil.stringColumnOf(data, "y"), equalTo(Arrays.asList("a", "b", "c"))); ValueUtil.stringColumnOf(data, "x"); }
@Test(expected = IllegalArgumentException.class) public void sttringColumnOf3() { VTable data = ValueFactory.newVTable(Arrays.<Class<?>>asList(double.class, String.class), Arrays.asList("x", "y"), Arrays.<Object>asList(new ArrayDouble(1,2,3), Arrays.asList("a", "b", "c"))); ValueUtil.stringColumnOf(data, "z"); }