UriTemplate { public static URI resolve(final URI baseUri, String refUri) { return resolve(baseUri, URI.create(refUri)); } private  UriTemplate(); @SuppressWarnings("DuplicateThrows")  UriTemplate(String template); @SuppressWarnings("DuplicateThrows") protected  UriTemplate(UriTemplateParser templateParser); static URI resolve(final URI baseUri, String refUri); static URI resolve(final URI baseUri, URI refUri); static URI normalize(final String uri); static URI normalize(final URI uri); static URI relativize(URI baseUri, URI refUri); final String getTemplate(); final PatternWithGroups getPattern(); @SuppressWarnings("UnusedDeclaration") final boolean endsWithSlash(); final List<String> getTemplateVariables(); @SuppressWarnings("UnusedDeclaration") final boolean isTemplateVariablePresent(String name); final int getNumberOfExplicitRegexes(); final int getNumberOfRegexGroups(); final int getNumberOfExplicitCharacters(); final int getNumberOfTemplateVariables(); final boolean match(CharSequence uri, Map<String, String> templateVariableToValue); final boolean match(CharSequence uri, List<String> groupValues); final String createURI(final Map<String, String> values); final String createURI(String... values); final String createURI(final String[] values, final int offset, final int length); @Override final String toString(); @Override final int hashCode(); @Override final boolean equals(Object o); static String createURI(
            final String scheme, String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final Map<String, ?> values, final boolean encode, final boolean encodeSlashInPath); static String createURIWithStringValues(
            final String scheme, final String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final Map<String, ?> values, final boolean encode, final boolean encodeSlashInPath); static String createURI(
            final String scheme, String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final Object[] values, final boolean encode, final boolean encodeSlashInPath); static String createURIWithStringValues(
            final String scheme, final String authority,
            final String userInfo, final String host, final String port,
            final String path, final String query, final String fragment,
            final String[] values, final boolean encode, final boolean encodeSlashInPath); @SuppressWarnings("unchecked") static String resolveTemplateValues(final UriComponent.Type type,
                                               String template,
                                               final boolean encode,
                                               final Map<String, ?> _mapValues); static final Comparator<UriTemplate> COMPARATOR; static final UriTemplate EMPTY; }
@Test public void testResolveUri() { final URI baseUri = URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g:h")), equalTo(URI.create("g:h"))); assertThat(UriTemplate.resolve(baseUri, URI.create("g:h")), equalTo(URI.create("g:h"))); assertThat(UriTemplate.resolve(baseUri, URI.create("g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("./g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g/")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("/g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create(" assertThat(UriTemplate.resolve(baseUri, URI.create("?y")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g?y")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("#s")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g#s")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g?y#s")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create(";x")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g;x")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g;x?y#s")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create(".")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("./")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("..")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("../")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("../g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("../..")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("../../")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("../../g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("../../../g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("../../../../g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("/./g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("/../g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g.")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create(".g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g..")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("..g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("./../g")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("./g/.")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g/./h")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g/../h")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g;x=1/./y")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g;x=1/../y")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g?y/./x")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g?y/../x")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g#s/./x")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("g#s/../x")), equalTo(URI.create("http: assertThat(UriTemplate.resolve(baseUri, URI.create("http:g")), equalTo(URI.create("http:g"))); assertThat(UriTemplate.resolve(baseUri, URI.create("")), equalTo(baseUri)); }