### Question:
URIUtil { public static URI getParent(URI uri) throws URISyntaxException { AssertArgument.isNotNull(uri, "uri"); String parentPath = new File(uri.getPath()).getParent(); if(parentPath == null) { return new URI("../"); } return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), parentPath.replace('\\', '/'), uri.getQuery(), uri.getFragment()); }  static URI getParent(URI uri);  }### Answer:
@Test public void test_getParent() throws URISyntaxException { URI uriIn; URI uriOut; uriIn = new URI("/a/b/s/x.txt"); uriOut = URIUtil.getParent(uriIn); assertEquals(new URI("/a/b/s"), uriOut); uriIn = new URI("file:/a/b/s/x.txt"); uriOut = URIUtil.getParent(uriIn); assertEquals(new URI("file:/a/b/s"), uriOut); uriIn = new URI("x.txt"); uriOut = URIUtil.getParent(uriIn); assertEquals(new URI("../"), uriOut); }