SW360Client { protected URI resolveAgainstBase(String uri) { URI base = getClientConfig().getBaseURI(); URI source = URI.create(uri); String path = resolvePath(base, source); try { return new URI(base.getScheme(), base.getAuthority(), path, source.getQuery(), source.getFragment()); } catch (URISyntaxException e) { throw new IllegalArgumentException("Invalid URI to resolve: " + uri); } } protected  SW360Client(SW360ClientConfig config, AccessTokenProvider tokenProvider); SW360ClientConfig getClientConfig(); AccessTokenProvider getTokenProvider();  }
@Test public void testCorrectUriIsResolved() { final String uri = BASE_REST_URI + "/releases/1234567890/attachments"; assertThat(client.resolveAgainstBase(uri).toString()).isEqualTo(uri); }
@Test public void testBaseIsCorrectlySetWhenResolving() { final String path = "/some/relative/path?foo=bar&baz=blub#fragment"; final String uri = "http: assertThat(client.resolveAgainstBase(uri).toString()).isEqualTo(BASE_REST_URI + path); }
@Test public void testRelativeUriCanBeResolved() { final String relativeUri = "/some/relative/path"; assertThat(client.resolveAgainstBase(relativeUri).toString()).isEqualTo(BASE_REST_URI + relativeUri); }
@Test(expected = IllegalArgumentException.class) public void testErrorHandling() { client.resolveAgainstBase(":"); }