Path { public String getRelative() { if (elements.isEmpty()) { return ""; } StringBuilder sb = new StringBuilder(); sb.append(elements.get(0)); for (int i = 1; i < elements.size(); i++) { sb.append(delimiter); sb.append(elements.get(i)); } return sb.toString(); } private  Path(String delimiter); private  Path(Path path); private  Path(List<String> elements, String delimiter); boolean isChildOf(Path parent); Path append(String path); Path append(Path path); String getName(); String getRelative(); Path getParentPath(); Path getChildPath(); String last(); Path withLast(String element); String getAbsolute(); boolean isRoot(); Iterator<String> iterator(); List<String> elements(); @Override String toString(); static Path fromString(String path); static Path fromString(String path, String delimiter); static Path createRoot(); static Path createRoot(String delimiter); File toFile(); @Override int hashCode(); @Override boolean equals(Object other);  }
@Test public void testGetPath() { assertThat(getAbsolutePath().getRelative(), is("foo/bar/baz")); assertThat(getRelativePath().getRelative(), is("foo/bar/baz")); assertThat(getWithSlashes().getRelative(), is("foo/bar/baz")); assertThat(getAppended().getRelative(), is("foo/bar/baz")); assertThat(getOne().getRelative(), is("foo")); }