### Question:
Lists { public static <T> List<T> gen(T... elements) { if (elements == null || elements.length == 0) return Collections.<T>emptyList(); List<T> list = (List<T>) Reflects.make(LIST_IMPL); for (T t : elements) { list.add(t); } return list; } private  Lists(); static List<T> gen(T... elements); static List<T> gen(int size, GenCall<T> generator); static U gen(int size, Class<U> container, GenCall<T> generator); static List<T> each(List<T> elements, EachCall<T> callback); static List<T> collect(List<T> elements, CollectCall<T> callback); static Map<String, List<T>> group(List<T> elements, GroupCall<T> callback); static boolean isEmpty(List<T> suspect); static PartialList<T> emptyPartialList(); @SuppressWarnings("rawtypes")
    static final PartialList EMPTY_PARTIAL_LIST; }### Answer:
@Test public void 単純genテスト() { List<String> elements = new ArrayList<String>(); elements.add("a"); elements.add("b"); elements.add("c"); elements.add("d"); elements.add("e"); List<String> results = Lists.gen("a", "b", "c", "d", "e"); Assert.assertEquals(elements, results); }
@Test public void コールバックgenテスト() { final List<String> elements = new ArrayList<String>(); elements.add("a"); elements.add("b"); elements.add("c"); elements.add("d"); elements.add("e"); List<String> results = Lists.gen(5, new GenCall<String>() { public String gen(int index, int total) { return elements.get(index); } }); Assert.assertEquals(elements, results); }
@Test public void 実際よりも少ない要素数を返却するコールバックgenテスト() { final List<String> elements = new ArrayList<String>(); elements.add("a"); elements.add("b"); elements.add("c"); elements.add("d"); elements.add("e"); List<String> results = Lists.gen(5, new GenCall<String>() { public String gen(int index, int total) { return index % 2 == 0 ? elements.get(index) : null; } }); Assert.assertEquals(Lists.gen("a", "c", "e"), results); Assert.assertEquals(3, results.size()); }