### Question:
PathUtil { public static String toBucketName(URI uri) { String authority = uri.getAuthority(); if (authority == null) { throw new IllegalArgumentException("URI " + uri + " has no authority part"); } return authority; } 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 nullUriToBucketName() { PathUtil.toBucketName(null); }
@Test(expected = IllegalArgumentException.class) public void protocolOnlyUriToBucketName() { PathUtil.toBucketName(URI.create("s3: }
@Test(expected = IllegalArgumentException.class) public void uriWithNoAuthorityToBucketName() { PathUtil.toBucketName(URI.create("/foo/bar")); }
@Test public void uriToBucketName() { assertThat(PathUtil.toBucketName(URI.create("s3: }
@Test(expected = IllegalArgumentException.class) public void protocolOnlyUriToBucketKey() { PathUtil.toBucketName(URI.create("s3: }