@Test public void testToHierarchicalUri() { for (final String[] params : new String[][] { { "foo:bar:baz:/x/bö%20m?plö%20k!/bä%20g?zö%20k!/", "baz:/x/bö%20m/bä%20g?zö%20k" }, { "bar:baz:/x/bö%20m?plö%20k!/bä%20g?zö%20k", "baz:/x/bö%20m/bä%20g?zö%20k" }, { "foo:bar:baz:/x/bööm?plönk!/bäng?zönk!/", "baz:/x/bööm/bäng?zönk" }, { "bar:baz:/x/bööm?plönk!/bäng?zönk", "baz:/x/bööm/bäng?zönk" }, { "foo:bar:baz:/boom?plonk!/bang?zonk!/", "baz:/boom/bang?zonk" }, { "bar:baz:/boom?plonk!/bang?zonk", "baz:/boom/bang?zonk" }, { "bar:baz:/boom?plonk!/?zonk", "baz:/boom/?zonk" }, { "bar:baz:/boom?plonk!/bang", "baz:/boom/bang" }, { "bar:baz:/boom?plonk!/", "baz:/boom?plonk" }, { "foo:bar:baz:/boom!/bang!/", "baz:/boom/bang" }, { "bar:baz:/boom!/bang", "baz:/boom/bang" }, { "foo:bar:/baz?boom!/", "bar:/baz?boom" }, { "bar:/baz?boom", "bar:/baz?boom" }, { "foo:bar:/baz!/", "bar:/baz" }, { "bar:/baz", "bar:/baz" }, { "foo:/bar/?boom", "foo:/bar/?boom" }, { "bar?boom", "bar?boom" }, { "foo:/bar/", "foo:/bar/" }, { "bar", "bar" }, }) { final FsNodePath path = FsNodePath.create(URI.create(params[0])); final URI hierarchical = path.toHierarchicalUri(); assertThat(hierarchical, equalTo(URI.create(params[1]))); } }
public URI toHierarchicalUri() { final URI hierarchical = this.hierarchical; if (null != hierarchical) return hierarchical; if (uri.isOpaque()) { final URI mpu = mountPoint.toHierarchicalUri(); final URI enu = nodeName.getUri(); try { return this.hierarchical = enu.toString().isEmpty() ? mpu : new UriBuilder(mpu, true) .path(mpu.getRawPath() + FsNodeName.SEPARATOR) .getUri() .resolve(enu); } catch (URISyntaxException ex) { throw new AssertionError(ex); } } else { return this.hierarchical = uri; } }
FsNodePath implements Serializable, Comparable<FsNodePath> { public URI toHierarchicalUri() { final URI hierarchical = this.hierarchical; if (null != hierarchical) return hierarchical; if (uri.isOpaque()) { final URI mpu = mountPoint.toHierarchicalUri(); final URI enu = nodeName.getUri(); try { return this.hierarchical = enu.toString().isEmpty() ? mpu : new UriBuilder(mpu, true) .path(mpu.getRawPath() + FsNodeName.SEPARATOR) .getUri() .resolve(enu); } catch (URISyntaxException ex) { throw new AssertionError(ex); } } else { return this.hierarchical = uri; } } }
FsNodePath implements Serializable, Comparable<FsNodePath> { public URI toHierarchicalUri() { final URI hierarchical = this.hierarchical; if (null != hierarchical) return hierarchical; if (uri.isOpaque()) { final URI mpu = mountPoint.toHierarchicalUri(); final URI enu = nodeName.getUri(); try { return this.hierarchical = enu.toString().isEmpty() ? mpu : new UriBuilder(mpu, true) .path(mpu.getRawPath() + FsNodeName.SEPARATOR) .getUri() .resolve(enu); } catch (URISyntaxException ex) { throw new AssertionError(ex); } } else { return this.hierarchical = uri; } } FsNodePath(File file); @ConstructorProperties("uri")  FsNodePath(URI uri);  FsNodePath(URI uri, FsUriModifier modifier);  FsNodePath(
            final @CheckForNull FsMountPoint mountPoint,
            final FsNodeName nodeName); }
FsNodePath implements Serializable, Comparable<FsNodePath> { public URI toHierarchicalUri() { final URI hierarchical = this.hierarchical; if (null != hierarchical) return hierarchical; if (uri.isOpaque()) { final URI mpu = mountPoint.toHierarchicalUri(); final URI enu = nodeName.getUri(); try { return this.hierarchical = enu.toString().isEmpty() ? mpu : new UriBuilder(mpu, true) .path(mpu.getRawPath() + FsNodeName.SEPARATOR) .getUri() .resolve(enu); } catch (URISyntaxException ex) { throw new AssertionError(ex); } } else { return this.hierarchical = uri; } } FsNodePath(File file); @ConstructorProperties("uri")  FsNodePath(URI uri);  FsNodePath(URI uri, FsUriModifier modifier);  FsNodePath(
            final @CheckForNull FsMountPoint mountPoint,
            final FsNodeName nodeName); static FsNodePath create(URI uri); static FsNodePath create(URI uri, FsUriModifier modifier); URI getUri(); URI toHierarchicalUri(); @Nullable FsMountPoint getMountPoint(); FsNodeName getNodeName(); FsNodePath resolve(final FsNodeName nodeName); @Override int compareTo(FsNodePath that); @Override boolean equals(@CheckForNull Object that); @Override int hashCode(); @Override String toString(); }
FsNodePath implements Serializable, Comparable<FsNodePath> { public URI toHierarchicalUri() { final URI hierarchical = this.hierarchical; if (null != hierarchical) return hierarchical; if (uri.isOpaque()) { final URI mpu = mountPoint.toHierarchicalUri(); final URI enu = nodeName.getUri(); try { return this.hierarchical = enu.toString().isEmpty() ? mpu : new UriBuilder(mpu, true) .path(mpu.getRawPath() + FsNodeName.SEPARATOR) .getUri() .resolve(enu); } catch (URISyntaxException ex) { throw new AssertionError(ex); } } else { return this.hierarchical = uri; } } FsNodePath(File file); @ConstructorProperties("uri")  FsNodePath(URI uri);  FsNodePath(URI uri, FsUriModifier modifier);  FsNodePath(
            final @CheckForNull FsMountPoint mountPoint,
            final FsNodeName nodeName); static FsNodePath create(URI uri); static FsNodePath create(URI uri, FsUriModifier modifier); URI getUri(); URI toHierarchicalUri(); @Nullable FsMountPoint getMountPoint(); FsNodeName getNodeName(); FsNodePath resolve(final FsNodeName nodeName); @Override int compareTo(FsNodePath that); @Override boolean equals(@CheckForNull Object that); @Override int hashCode(); @Override String toString();  }