### Question:
ArrayHelper { public static String[][] to2DStringArray(Collection coll) { return (String[][]) coll.toArray( new String[coll.size()][] ); }  static String[] toStringArray(Collection coll); static String[][] to2DStringArray(Collection coll); static String[] slice(String[] strings, int begin, int length); static int indexOf(T[] array, T element); static boolean contains(Object[] array, Object element); static T[] concat(T[] first, T... second); static T[] concat(List<T[]> arrays); static T[] concat(T firstElement, T... array); static final int[] EMPTY_INT_ARRAY; static final String[] EMPTY_STRING_ARRAY; static final Object[] EMPTY_OBJECT_ARRAY; }### Answer:
@Test public void testTo2DStringArray() { List<String[]> keyColumns = new ArrayList<>(); keyColumns.add( new String[]{ "col1", "col2" } ); keyColumns.add( new String[]{ "col3", "col4", "col5" } ); keyColumns.add( new String[]{ "col1" } ); String[][] expectedArr = new String[3][]; expectedArr[0] = keyColumns.get( 0 ); expectedArr[1] = keyColumns.get( 1 ); expectedArr[2] = keyColumns.get( 2 ); String[][] resultArr = ArrayHelper.to2DStringArray( keyColumns ); assertThat( resultArr ).isEqualTo( expectedArr ); }