### Question:
PathUtil { public static String toBucketKey(URI uri) { String key = uri.getPath().substring(1); if (key.isEmpty()) { throw new IllegalArgumentException("URI " + uri + " has no path part"); } return key; } private  PathUtil(); static String getRelativePath(Path sourceRootPath, Path childPath); static String toString(Path path); static String toBucketName(URI uri); static String toBucketKey(URI uri); static boolean isFile(URI path);  }### Answer:
@Test(expected = NullPointerException.class) public void nullUriToBucketKey() { PathUtil.toBucketKey(null); }
@Test public void uriWithNoAuthorityToBucketKey() { assertThat(PathUtil.toBucketKey(URI.create("/foo/bar")), is("foo/bar")); }
@Test public void uriToBucketKey() { assertThat(PathUtil.toBucketKey(URI.create("s3: }
@Test(expected = IllegalArgumentException.class) public void uriWithNoPathToBucketKey() { PathUtil.toBucketKey(URI.create("s3: }