use of scaffolding.ServerUtils.httpsServerForTest in project mu-server by 3redronin.
the class JaxMatchingTest method matrixParametersMatchDefaultPathParamRegex.
@Test
public void matrixParametersMatchDefaultPathParamRegex() throws IOException {
@Path("/blah/{thing}")
class Thing {
@GET
@Path("/something")
public String get(@PathParam("thing") String thing) {
return thing;
}
}
server = ServerUtils.httpsServerForTest().addHandler(RestHandlerBuilder.restHandler(new Thing()).build()).start();
URI matrixUri = server.uri().resolve("/blah;ignored=true/tiger;color=red;type=cat/something;ignored=true");
try (Response resp = call(request().url(matrixUri.toString()))) {
assertThat(resp.body().string(), is("tiger"));
}
}
use of scaffolding.ServerUtils.httpsServerForTest in project mu-server by 3redronin.
the class JaxMatchingTest method interfacesWithDefaultImplementationSupported.
@Test
public void interfacesWithDefaultImplementationSupported() throws IOException {
server = ServerUtils.httpsServerForTest().addHandler(restHandler(new DefaultImplementationResource())).start();
try (Response resp = call(request(server.uri().resolve("/default-impl/jax1")))) {
assertThat(resp.code(), Matchers.is(200));
assertThat(resp.body().string(), equalTo("Hello from default impl"));
}
try (Response resp = call(request(server.uri().resolve("/default-impl/jax2")))) {
assertThat(resp.code(), Matchers.is(200));
assertThat(resp.body().string(), equalTo("Overwritten by implementation"));
}
}
Aggregations