UriUtils { public static URI urlToUri( URL url ) throws URISyntaxException { URI uri; try { uri = url.toURI(); } catch( Exception e ) { try { uri = new URI( url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef()); } catch( Exception e1 ) { throw new URISyntaxException( String.valueOf( url ), "Broken URL." ); } } uri = uri.normalize(); return uri; } private  UriUtils(); static URI urlToUri( URL url ); static URI urlToUri( String urlAsString ); static URI buildNewURI( URI referenceUri, String uriSuffix );  }
@Test public void testUrlToUri_1() throws Exception { URL url = new URL( "http: Assert.assertEquals( url.toURI(), UriUtils.urlToUri( url )); }
@Test public void testUrlToUri_2() throws Exception { URL url = new URL( "http: Assert.assertEquals( url.toURI(), UriUtils.urlToUri( url )); }
@Test public void testUrlToUri_3() throws Exception { URL url = new URL( "http: Assert.assertEquals( new URI( "http: UriUtils.urlToUri( url )); }
@Test public void testUrlToUri_4() throws Exception { String url = "http: Assert.assertEquals( new URI( url ), UriUtils.urlToUri( url )); }
@Test public void testUrlToUri_5() throws Exception { String url = "http: Assert.assertEquals( new URI( url ), UriUtils.urlToUri( url )); }
@Test public void testUrlToUri_6() throws Exception { String url = "http: Assert.assertEquals( new URI( "http: UriUtils.urlToUri( url )); }
@Test( expected = URISyntaxException.class ) public void testUrlToUri_exception1() throws Exception { String url = "http: UriUtils.urlToUri( url ); }
@Test( expected = URISyntaxException.class ) public void testUrlToUri_exception2() throws Exception { String url = "http: UriUtils.urlToUri( url ); }