public void testIteratorConstructor_null_remove() { Iterator it = new ObjectGraphIterator(null); try { it.remove(); fail(); } catch (IllegalStateException ex) { } }
public void testIteratorConstructor_null_next() { Iterator it = new ObjectGraphIterator(null); try { it.next(); fail(); } catch (NoSuchElementException ex) { } }
public void testIteratorConstructorIteration_Empty() { List iteratorList = new ArrayList(); Iterator it = new ObjectGraphIterator(iteratorList.iterator()); assertEquals(false, it.hasNext()); try { it.next(); fail(); } catch (NoSuchElementException ex) { } try { it.remove(); fail(); } catch (IllegalStateException ex) { } }
public void testIteratorConstructorIteration_SimpleNoHasNext() { List iteratorList = new ArrayList(); iteratorList.add(list1.iterator()); iteratorList.add(list2.iterator()); iteratorList.add(list3.iterator()); Iterator it = new ObjectGraphIterator(iteratorList.iterator()); for (int i = 0; i < 6; i++) { assertEquals(testArray[i], it.next()); } try { it.next(); fail(); } catch (NoSuchElementException ex) { } }
public void testIteratorConstructorIteration_Simple() { List iteratorList = new ArrayList(); iteratorList.add(list1.iterator()); iteratorList.add(list2.iterator()); iteratorList.add(list3.iterator()); Iterator it = new ObjectGraphIterator(iteratorList.iterator()); for (int i = 0; i < 6; i++) { assertEquals(true, it.hasNext()); assertEquals(testArray[i], it.next()); } assertEquals(false, it.hasNext()); try { it.next(); fail(); } catch (NoSuchElementException ex) { } }
public void testIteratorConstructorIteration_WithEmptyIterators() { List iteratorList = new ArrayList(); iteratorList.add(IteratorUtils.EMPTY_ITERATOR); iteratorList.add(list1.iterator()); iteratorList.add(IteratorUtils.EMPTY_ITERATOR); iteratorList.add(list2.iterator()); iteratorList.add(IteratorUtils.EMPTY_ITERATOR); iteratorList.add(list3.iterator()); iteratorList.add(IteratorUtils.EMPTY_ITERATOR); Iterator it = new ObjectGraphIterator(iteratorList.iterator()); for (int i = 0; i < 6; i++) { assertEquals(true, it.hasNext()); assertEquals(testArray[i], it.next()); } assertEquals(false, it.hasNext()); try { it.next(); fail(); } catch (NoSuchElementException ex) { } }
public void testIteration_RootNoTransformer() { Forest forest = new Forest(); Iterator it = new ObjectGraphIterator(forest, null); assertEquals(true, it.hasNext()); assertSame(forest, it.next()); assertEquals(false, it.hasNext()); try { it.next(); fail(); } catch (NoSuchElementException ex) { } }
public void testIteration_Transformed1() { Forest forest = new Forest(); Leaf l1 = forest.addTree().addBranch().addLeaf(); Iterator it = new ObjectGraphIterator(forest, new LeafFinder()); assertEquals(true, it.hasNext()); assertSame(l1, it.next()); assertEquals(false, it.hasNext()); try { it.next(); fail(); } catch (NoSuchElementException ex) { } }
try { it.next(); fail(); } catch (NoSuchElementException ex) {
try { it.next(); fail(); } catch (NoSuchElementException ex) {