Search in sources :

Example 91 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.

the class QueryParamAsSortedSetPrimitiveTest method testBadPrimitiveSortedSetValue.

@Test
public void testBadPrimitiveSortedSetValue() throws ExecutionException, InterruptedException {
    final ContainerResponse response = super.getResponseContext("/SortedSet?int=abcdef&int=abcdef", "application/int");
    assertEquals(404, response.getStatus());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 92 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.

the class QueryParamAsStringTest method testStringPost.

@Test
public void testStringPost() throws ExecutionException, InterruptedException {
    initiateWebApplication(ResourceString.class);
    final ContainerResponse responseContext = apply(RequestContextBuilder.from("/?arg1=a&arg2=b&arg3=c", "POST").entity("content").build());
    assertEquals("content", responseContext.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 93 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.

the class HeaderParamStringConstructorTest method testBadStringConstructorValue.

@Test
public void testBadStringConstructorValue() throws ExecutionException, InterruptedException {
    initiateWebApplication(ResourceString.class);
    final ContainerResponse responseContext = apply(RequestContextBuilder.from("/", "GET").header("arg1", "ABCDEF").header("arg2", "3145").header("arg3", "http://test").build());
    assertEquals(400, responseContext.getStatus());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 94 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.

the class InvalidParamsTest method testInvalidPathParam.

@Test
public void testInvalidPathParam() throws Exception {
    ContainerResponse responseContext = createApplication(ResourceInvalidParams.class).apply(RequestContextBuilder.from("/invalid/path/param", "GET").build()).get();
    // returned param is null -> 204 NO CONTENT
    assertEquals(204, responseContext.getStatus());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 95 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.

the class MatrixParamAsPrimitiveTest method testBadPrimitiveListValue.

@Test
public void testBadPrimitiveListValue() throws ExecutionException, InterruptedException {
    final ContainerResponse responseContext = apply(RequestContextBuilder.from("/list;int=abcdef;int=abcdef", "GET").accept("application/int").build());
    assertEquals(404, responseContext.getStatus());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Aggregations

ContainerResponse (org.glassfish.jersey.server.ContainerResponse)211 Test (org.junit.Test)190 ApplicationHandler (org.glassfish.jersey.server.ApplicationHandler)95 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)58 MediaType (javax.ws.rs.core.MediaType)16 Form (javax.ws.rs.core.Form)14 ContainerRequest (org.glassfish.jersey.server.ContainerRequest)14 Cookie (javax.ws.rs.core.Cookie)7 Response (javax.ws.rs.core.Response)5 Ignore (org.junit.Ignore)4 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 ContainerRequestContext (javax.ws.rs.container.ContainerRequestContext)2 ContainerResponseFilter (javax.ws.rs.container.ContainerResponseFilter)2 ContainerException (org.glassfish.jersey.server.ContainerException)2 RequestContextBuilder (org.glassfish.jersey.server.RequestContextBuilder)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 URI (java.net.URI)1 HashSet (java.util.HashSet)1