MinimalPathIterator implements Iterator { public MinimalPathIterator(SimpleGraph g, Object sourceVertex, Object targetVertex) { this.g = g; this.sourceVertex = sourceVertex; this.targetVertex = targetVertex; createShortestPathGraph(); } MinimalPathIterator(SimpleGraph g, Object sourceVertex, Object targetVertex); @Override boolean hasNext(); @Override Object next(); @Override void remove();  }
@Test public void testMinimalPathIterator() { int count = 0; for (MinimalPathIterator i = new MinimalPathIterator(g, "a", "l"); i.hasNext();) { Assert.assertTrue(((List) i.next()).size() == 5); count++; } Assert.assertEquals(10, count); }