### Question:
AmazonS3URIs { public static AmazonS3URI toAmazonS3URI(URI uri) { if (FS_PROTOCOL_S3.equalsIgnoreCase(uri.getScheme())) { return new AmazonS3URI(uri); } else if (S3Schemes.isS3Scheme(uri.getScheme())) { try { return new AmazonS3URI(new URI(FS_PROTOCOL_S3, uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment())); } catch (URISyntaxException e) { } } return new AmazonS3URI(uri); } private  AmazonS3URIs(); static AmazonS3URI toAmazonS3URI(URI uri);  }### Answer:
@Test public void toAmazonS3URISchemeIsS3() throws Exception { AmazonS3URI result = AmazonS3URIs.toAmazonS3URI(new URI("s3: AmazonS3URI expected = new AmazonS3URI("s3: assertThat(result, is(expected)); }
@Test public void toAmazonS3URISchemeIsS3Uppercase() throws Exception { AmazonS3URI result = AmazonS3URIs.toAmazonS3URI(new URI("S3: AmazonS3URI expected = new AmazonS3URI("s3: assertThat(result, is(expected)); }
@Test public void toAmazonS3URISchemeIsS3a() throws Exception { AmazonS3URI result = AmazonS3URIs.toAmazonS3URI(new URI("s3a: AmazonS3URI expected = new AmazonS3URI("s3: assertThat(result, is(expected)); }
@Test public void toAmazonS3URISchemeIsS3aUppercase() throws Exception { AmazonS3URI result = AmazonS3URIs.toAmazonS3URI(new URI("S3A: AmazonS3URI expected = new AmazonS3URI("s3: assertThat(result, is(expected)); }
@Test public void toAmazonS3URISchemeIsS3n() throws Exception { AmazonS3URI result = AmazonS3URIs.toAmazonS3URI(new URI("s3n: AmazonS3URI expected = new AmazonS3URI("s3: assertThat(result, is(expected)); }
@Test public void toAmazonS3URISchemeIsS3nUppercase() throws Exception { AmazonS3URI result = AmazonS3URIs.toAmazonS3URI(new URI("S3N: AmazonS3URI expected = new AmazonS3URI("s3: assertThat(result, is(expected)); }
@Test(expected = IllegalArgumentException.class) public void toAmazonS3URISchemeIsInvalidS3Scheme() throws Exception { AmazonS3URIs.toAmazonS3URI(new URI("s321: }
@Test(expected = IllegalArgumentException.class) public void toAmazonS3URISchemeIsNonAmazon() throws Exception { AmazonS3URIs.toAmazonS3URI(new URI("file: }
@Test(expected = IllegalArgumentException.class) public void toAmazonS3URISchemeIsNullScheme() throws Exception { AmazonS3URIs.toAmazonS3URI(new URI("/a/b")); }