### Question:
PathParentIterator implements Iterator<String> { public static PathParentIterator forPathOnly(String path) { return new PathParentIterator(path, 0); } private  PathParentIterator(String path, int maxLevel); static PathParentIterator forAll(String path); static PathParentIterator forPathOnly(String path); Iterable<String> asIterable(); @Override boolean hasNext(); boolean atParentPath(); @Override String next(); @Override void remove();  }### Answer:
@Test public void testForPathOnly() { PathParentIterator pathParentIterator = PathParentIterator.forPathOnly("/a/b/c/d"); assertTrue(pathParentIterator.hasNext()); assertEquals(pathParentIterator.next(), "/a/b/c/d"); assertFalse(pathParentIterator.atParentPath()); assertFalse(pathParentIterator.hasNext()); }