PDOutlineItemIterator implements Iterator<PDOutlineItem> { @Override public void remove() { throw new UnsupportedOperationException(); } PDOutlineItemIterator(PDOutlineItem startingItem); @Override boolean hasNext(); @Override PDOutlineItem next(); @Override void remove();  }
@Test(expected = UnsupportedOperationException.class) public void removeUnsupported() { new PDOutlineItemIterator(new PDOutlineItem()).remove(); }