use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class CookieParamAsCookieTest method testCookieParam.
@Test
public void testCookieParam() throws ExecutionException, InterruptedException {
initiateWebApplication(CookieTypeResource.class);
Cookie one = new Cookie("one", "value_one");
Cookie two = new Cookie("two", "value_two");
assertEquals("content", apply(RequestContextBuilder.from("/", "POST").cookie(one).cookie(two).build()).getEntity());
}
use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class CookieParamAsPrimitiveTest method testBadPrimitiveListValue.
@Test
public void testBadPrimitiveListValue() throws ExecutionException, InterruptedException {
final ContainerResponse responseContext = apply(RequestContextBuilder.from("/wrappers", "GET").accept("application/int").cookie(new Cookie("int", "abcdef")).build());
assertEquals(400, responseContext.getStatus());
}
use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class CookieParamAsPrimitiveTest method _test.
void _test(String type, String value) throws ExecutionException, InterruptedException {
assertEquals("content", apply(RequestContextBuilder.from("/", "GET").accept("application/" + type).cookie(new Cookie(type, value)).build()).getEntity());
assertEquals("content", apply(RequestContextBuilder.from("/wrappers", "GET").accept("application/" + type).cookie(new Cookie(type, value)).build()).getEntity());
assertEquals("content", apply(RequestContextBuilder.from("/list", "GET").accept("application/" + type).cookie(new Cookie(type, value)).build()).getEntity());
}
use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class CookieParamAsPrimitiveTest method testBadPrimitiveWrapperValue.
@Test
public void testBadPrimitiveWrapperValue() throws ExecutionException, InterruptedException {
final ContainerResponse responseContext = apply(RequestContextBuilder.from("/wrappers", "GET").accept("application/int").cookie(new Cookie("int", "abcdef")).build());
assertEquals(400, responseContext.getStatus());
}
use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class CookieParamAsStringTest method testListDefaultOverride.
@Test
public void testListDefaultOverride() throws ExecutionException, InterruptedException {
initiateWebApplication(ResourceStringListDefaultOverride.class);
_test("/", "application/list", new Cookie("args", "b"));
}
Aggregations