Path { public int getDepth() { return getSegments().size(); } Path(String path); Path append(Path append); int getDepth(); String getName(); Path getParent(); List<String> getSegments(); boolean isEmptyPath(); Path subpath(int from, int to); @Override String toString();  }
@Test public void testGetDepth() { assertThat(new Path("/").getDepth(), is(0)); assertThat(new Path("/foo").getDepth(), is(1)); assertThat(new Path("/foo/bar").getDepth(), is(2)); }