use of javax.ws.rs.client.Entity in project jersey by jersey.
the class GenericResponseTest method testAsyncPost.
@Test
public void testAsyncPost() throws ExecutionException, InterruptedException {
GenericType<Response> generic = new GenericType<Response>(Response.class);
Entity entity = Entity.entity("entity", MediaType.WILDCARD_TYPE);
WebTarget target = target("resource");
final AsyncInvoker async = target.request().async();
Response response = async.post(entity, generic).get();
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("entity", response.readEntity(String.class));
}
use of javax.ws.rs.client.Entity in project jersey by jersey.
the class GenericResponseTest method testPost.
@Test
public void testPost() {
GenericType<Response> generic = new GenericType<Response>(Response.class);
Entity entity = Entity.entity("entity", MediaType.WILDCARD_TYPE);
WebTarget target = target("resource");
SyncInvoker sync = target.request();
Response response = sync.post(entity, generic);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("entity", response.readEntity(String.class));
}
use of javax.ws.rs.client.Entity in project jersey by jersey.
the class HttpMethodEntityTest method _test.
public void _test(String method, boolean entityPresent, boolean shouldFail) {
Entity entity = entityPresent ? Entity.entity("entity", MediaType.TEXT_PLAIN_TYPE) : null;
_testSync(method, entity, shouldFail);
_testAsync(method, entity, shouldFail);
}
Aggregations