PDOutlineItemIterator implements Iterator<PDOutlineItem> { @Override public boolean hasNext() { return startingItem != null && (currentItem == null || (currentItem.getNextSibling() != null && !startingItem .equals(currentItem.getNextSibling()))); } PDOutlineItemIterator(PDOutlineItem startingItem); @Override boolean hasNext(); @Override PDOutlineItem next(); @Override void remove();  }
@Test public void noChildren() { PDOutlineItemIterator iterator = new PDOutlineItemIterator(null); assertFalse(iterator.hasNext()); }