URIBuilder { public URI build() throws URISyntaxException { return new URI(buildString()); } URIBuilder();  URIBuilder(final String string);  URIBuilder(final URI uri);  URIBuilder(final String string, final Charset charset);  URIBuilder(final URI uri, final Charset charset); static URIBuilder localhost(); static URIBuilder loopbackAddress(); URIBuilder setCharset(final Charset charset); Charset getCharset(); URI build(); URIBuilder setScheme(final String scheme); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final NameValuePair... nvps); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final List <NameValuePair> nvps); URIBuilder setUserInfo(final String userInfo); @Deprecated URIBuilder setUserInfo(final String username, final String password); URIBuilder setHost(final InetAddress host); URIBuilder setHost(final String host); URIBuilder setHttpHost(final HttpHost httpHost ); URIBuilder setPort(final int port); URIBuilder setPath(final String path); URIBuilder setPathSegments(final String... pathSegments); URIBuilder setPathSegmentsRootless(final String... pathSegments); URIBuilder setPathSegments(final List<String> pathSegments); URIBuilder setPathSegmentsRootless(final List<String> pathSegments); URIBuilder removeQuery(); URIBuilder setParameters(final List <NameValuePair> nvps); URIBuilder addParameters(final List <NameValuePair> nvps); URIBuilder setParameters(final NameValuePair... nvps); URIBuilder addParameter(final String param, final String value); URIBuilder setParameter(final String param, final String value); URIBuilder clearParameters(); URIBuilder setCustomQuery(final String query); URIBuilder setFragment(final String fragment); boolean isAbsolute(); boolean isOpaque(); String getScheme(); String getSchemeSpecificPart(); String getUserInfo(); String getHost(); int getPort(); boolean isPathEmpty(); List<String> getPathSegments(); String getPath(); boolean isQueryEmpty(); List<NameValuePair> getQueryParams(); String getFragment(); @Override String toString();  }
@Test public void testHierarchicalUri() throws Exception { final URI uri = new URI("http", "stuff", "localhost", 80, "/some stuff", "param=stuff", "fragment"); final URIBuilder uribuilder = new URIBuilder(uri); final URI result = uribuilder.build(); Assert.assertEquals(new URI("http: }
@Test public void testOpaqueUri() throws Exception { final URI uri = new URI("stuff", "some-stuff", "fragment"); final URIBuilder uribuilder = new URIBuilder(uri); final URI result = uribuilder.build(); Assert.assertEquals(uri, result); }
@Test public void testEmpty() throws Exception { final URIBuilder uribuilder = new URIBuilder(); final URI result = uribuilder.build(); Assert.assertEquals(new URI(""), result); }
@Test public void testRelativePath() throws Exception { final URI uri = new URIBuilder("./mypath").build(); Assert.assertEquals(new URI("./mypath"), uri); }