MinimalPathIterator implements Iterator { @Override public void remove() { throw new UnsupportedOperationException(); } MinimalPathIterator(SimpleGraph g, Object sourceVertex, Object targetVertex); @Override boolean hasNext(); @Override Object next(); @Override void remove();  }
@Test(expected = UnsupportedOperationException.class) public void testRemove() { for (MinimalPathIterator i = new MinimalPathIterator(g, "a", "l"); i.hasNext();) { Assert.assertTrue(((List) i.next()).size() == 5); i.remove(); } }