use of javax.ws.rs.client.SyncInvoker 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.SyncInvoker in project jersey by jersey.
the class GenericResponseTest method testGetGenericString.
@Test
public void testGetGenericString() {
GenericType<String> generic = new GenericType<String>(String.class);
WebTarget target = target("resource");
SyncInvoker sync = target.request();
final String entity = sync.get(generic);
Assert.assertEquals("get", entity);
}
use of javax.ws.rs.client.SyncInvoker in project jersey by jersey.
the class NonSuccessfulResponseTest method generalTestPost.
private void generalTestPost(int status) {
Entity<String> entity = Entity.entity("entity", MediaType.WILDCARD_TYPE);
WebTarget target = target("resource").path(Integer.toString(status));
SyncInvoker sync = target.request();
Response response = sync.post(entity, Response.class);
Assert.assertEquals(status, response.getStatus());
Assert.assertEquals("entity", response.readEntity(String.class));
}
use of javax.ws.rs.client.SyncInvoker in project jersey by jersey.
the class NonSuccessfulResponseTest method generalTestGet.
private void generalTestGet(int status) {
WebTarget target = target("resource").path(Integer.toString(status));
SyncInvoker sync = target.request();
Response response = sync.get(Response.class);
Assert.assertEquals(status, response.getStatus());
Assert.assertEquals("get", response.readEntity(String.class));
}
use of javax.ws.rs.client.SyncInvoker in project jersey by jersey.
the class GenericResponseTest method testGet.
@Test
public void testGet() {
GenericType<Response> generic = new GenericType<Response>(Response.class);
WebTarget target = target("resource");
SyncInvoker sync = target.request();
Response response = sync.get(generic);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("get", response.readEntity(String.class));
}
Aggregations