### Question:
Arrays { public static <T> T[] gen(T... elements) { return elements; } private  Arrays(); static T[] gen(T... elements); @SuppressWarnings("unchecked") static T[] gen(int size, GenCall<T> generator); static int contain(T[] t, T suspect); static Iterator<T> iterator(T... elements); @SuppressWarnings("unchecked") static T[] merge(final T[] former, final T... latter); static T[] each(T[] elements, EachCall<T> callback); @SuppressWarnings("unchecked") static T[] collect(T[] elements, CollectCall<T> callback); @SuppressWarnings("unchecked") static Map<String, T[]> group(T[] elements, GroupCall<T> callback); static boolean isEmpty(T[] suspect); static boolean isNotEmpty(T[] suspect); static T[] slice(T[] slicee, int start); @SuppressWarnings("unchecked") static T[] slice(T[] slicee, int start, int length);  }### Answer:
@Test public void 単純genテスト() { String[] elements = {"a", "b", "c", "d", "e"}; String[] results = Arrays.gen("a", "b", "c", "d", "e"); Assert.assertArrayEquals(elements, results); }
@Test public void コールバックgenテスト() { final String[] elements = {"a", "b", "c", "d", "e"}; String[] results = Arrays.gen(5, new GenCall<String>() { public String gen(int index, int total) { return elements[index]; } }); Assert.assertArrayEquals(elements, results); }