SimpleUrl { @VisibleForTesting static String simplifyPath(String path) { String simplified = Files.simplifyPath(path); if (CURRENT_PATH.equals(simplified)) { return ""; } return simplified; } SimpleUrl(String url); String getUrl(); String getSimplified();  }
@Test() public void simplifyPathShouldThrowOnNull() { assertThatThrownBy(() -> SimpleUrl.simplifyPath(null)).isInstanceOf(NullPointerException.class); }
@Test public void simplifyPathShouldReturnEmptyOnEmptyArray() { String actual = SimpleUrl.simplifyPath(""); assertThat(actual).isEmpty(); }
@Test public void simplifyPathShoudReturnEmptyWhenSimplifyingCurrentDir() { String actual = SimpleUrl.simplifyPath("./bar/.././foo/.."); assertThat(actual).isEmpty(); }
@Test public void simplifyPathShoudReturnSimplifiedDirectory() { String actual = SimpleUrl.simplifyPath("../foo/../bar/./baz"); assertThat(actual).isEqualTo("../bar/baz"); }