Url { public static URL parse(String uri) throws URISyntaxException, MalformedURLException { return parse(new URI(uri)); } private  Url(); static URL parse(String uri); static URL parse(URI uri); static String extractId(String url); static String extractId(URL url);  }
@Test public void parseNoProtocol() throws MalformedURLException, URISyntaxException { URL url = Url.parse(" assertThat(url.getProtocol(), is("https")); assertThat(url.getHost(), is("localhost")); assertThat(url.getPort(), is(3000)); }
@Test public void parseNamespace() throws MalformedURLException, URISyntaxException { assertThat(Url.parse("http: assertThat(Url.parse("http: assertThat(Url.parse("http: }
@Test public void parseDefaultPort() throws MalformedURLException, URISyntaxException { assertThat(Url.parse("http: assertThat(Url.parse("https: }
@Test public void parse() throws MalformedURLException, URISyntaxException { assertThat(Url.parse("http: is("http: }
@Test public void parseRelativePath() throws MalformedURLException, URISyntaxException { URL url = Url.parse("https: assertThat(url.getProtocol(), is("https")); assertThat(url.getHost(), is("woot.com")); assertThat(url.getPath(), is("/test")); }