use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class ResourceInfoTest method testInfoGet.
@Test
public void testInfoGet() throws ExecutionException, InterruptedException {
ApplicationHandler handler = getApplication();
final ContainerResponse response = handler.apply(RequestContextBuilder.from("/info", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get-info", response.getEntity());
assertResponseHeaders(response, "ResourceTestingInfo", "getInfo");
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class ParamConverterInternalTest method testLazyConverter.
@Test
public void testLazyConverter() throws Exception {
final ApplicationHandler application = new ApplicationHandler(new ResourceConfig(MyLazyParamProvider.class, Resource.class));
final ContainerResponse response = application.apply(RequestContextBuilder.from("/resource", "GET").build()).get();
assertEquals(400, response.getStatus());
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class ParamExceptionMappingTest method testURIParamException.
@Test
public void testURIParamException() throws ExecutionException, InterruptedException {
initiateWebApplication(ParamExceptionMapperResource.class, UriExceptionMapper.class);
ContainerResponse responseContext = getResponseContext(UriBuilder.fromPath("/").path("path/ 123").build().toString());
assertEquals("uri", responseContext.getEntity());
responseContext = getResponseContext(UriBuilder.fromPath("/").path("matrix;x= 123").build().toString());
assertEquals("uri", responseContext.getEntity());
responseContext = getResponseContext(UriBuilder.fromPath("/").path("query").queryParam("x", " 123").build().toString());
assertEquals("uri", responseContext.getEntity());
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class ParamExceptionMappingTest method testGeneralParamException.
@Test
public void testGeneralParamException() throws ExecutionException, InterruptedException {
initiateWebApplication(ParamExceptionMapperResource.class, ParamExceptionMapper.class);
ContainerResponse responseContext = getResponseContext(UriBuilder.fromPath("/").path("path/ 123").build().toString());
assertEquals("param", responseContext.getEntity());
responseContext = getResponseContext(UriBuilder.fromPath("/").path("matrix;x= 123").build().toString());
assertEquals("param", responseContext.getEntity());
responseContext = getResponseContext(UriBuilder.fromPath("/").path("query").queryParam("x", " 123").build().toString());
assertEquals("param", responseContext.getEntity());
responseContext = getResponseContext(UriBuilder.fromPath("/").path("cookie").build().toString(), new Cookie("x", " 123"));
assertEquals("param", responseContext.getEntity());
responseContext = apply(RequestContextBuilder.from("/header", "GET").header("x", " 123").build());
assertEquals("param", responseContext.getEntity());
Form f = new Form();
f.param("x", " 123");
responseContext = apply(RequestContextBuilder.from("/form", "POST").type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).entity(f).build());
assertEquals("param", responseContext.getEntity());
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class PathParamAsPrimitiveTest method testBadPrimitiveValue.
@Test
public void testBadPrimitiveValue() throws Exception {
ContainerResponse responseContext = app.apply(RequestContextBuilder.from("/int/abcdef", "GET").build()).get();
assertEquals(404, responseContext.getStatus());
}
Aggregations