use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method testBuildFromArrayNoSlashInUri.
// regression test for JERSEY-1114
@Test
public void testBuildFromArrayNoSlashInUri() {
final UriBuilder builder = new JerseyUriBuilder().uri(URI.create("http://localhost:8080")).path("test");
assertEquals("http://localhost:8080/test", builder.build("testing").toString());
}
use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method testBuildNoSlashUri.
// for completeness (added along with regression tests for JERSEY-1114)
@Test
public void testBuildNoSlashUri() {
final UriBuilder builder = new JerseyUriBuilder().uri(URI.create("http://localhost:8080")).path("test");
assertEquals("http://localhost:8080/test", builder.build().toString());
}
use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method shouldLeaveURIUntouchedAndKeepSlash.
// Reproducer for JERSEY-2537
@Test
public void shouldLeaveURIUntouchedAndKeepSlash() {
final UriBuilder builder = UriBuilder.fromPath("/apples;order=random;color=blue/2006/").replaceMatrix(null);
final URI result = builder.build();
assertEquals("/apples;order=random;color=blue/2006/", result.toString());
}
use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method testBuildFromMapNoSlashInUri.
// regression test for JERSEY-1114
@Test
public void testBuildFromMapNoSlashInUri() {
final UriBuilder builder = new JerseyUriBuilder().uri(URI.create("http://localhost:8080")).path("test");
assertEquals("http://localhost:8080/test", builder.buildFromMap(new HashMap<String, Object>()).toString());
}
use of javax.ws.rs.core.UriBuilder in project jersey by jersey.
the class JerseyUriBuilderTest method resolveTemplateMultipleCall.
@Test
public void resolveTemplateMultipleCall() {
final UriBuilder uriBuilder = UriBuilder.fromPath("http://localhost:8080").path("{start}").path("{a}").resolveTemplate("a", "first-a").path("{a}").resolveTemplate("a", "second-a").path("{a}/{a}").resolveTemplate("a", "twice-a");
Assert.assertEquals(URI.create("http://localhost:8080/start-path/first-a/second-a/twice-a/twice-a"), uriBuilder.build("start-path"));
}
Aggregations