@Test public void oneLevel() { it = new MultiIterator(Arrays.asList(list1)); assertIteratorEquals(Arrays.asList(row(1), row(2)).iterator(), it); }
@Test public void threeLevels() { list1 = Arrays.asList(1, 2); list2 = Arrays.asList(10, 20, 30); list3 = Arrays.asList(100, 200, 300, 400); it = new MultiIterator(Arrays.asList(list1, list2, list3)); List<Object[]> list = new ArrayList<Object[]>(); for (Object a : row(1, 2)) { for (Object b : row(10, 20, 30)) { for (Object c : row(100, 200, 300, 400)) { list.add(row(a, b, c)); } } } assertIteratorEquals(list.iterator(), it); }
@Test public void fourLevels() { list1 = Arrays.asList(1, 2); list2 = Arrays.asList(10, 20, 30); list3 = Arrays.asList(100, 200, 300, 400); list4 = Arrays.asList(1000, 2000, 3000, 4000, 5000); it = new MultiIterator(Arrays.asList(list1, list2, list3, list4)); List<Object[]> list = new ArrayList<Object[]>(); for (Object a : row(1, 2)) { for (Object b : row(10, 20, 30)) { for (Object c : row(100, 200, 300, 400)) { for (Object d : row(1000, 2000, 3000, 4000, 5000)) { list.add(row(a, b, c, d)); } } } } assertIteratorEquals(list.iterator(), it); }