use of javax.ws.rs.client.ResponseProcessingException in project jersey by jersey.
the class ClientFilterTest method ioExceptionResponseFilterTest.
@Test
public void ioExceptionResponseFilterTest() {
final WebTarget target = target();
target.register(IOExceptionResponseFilter.class).register(LoggingFeature.class);
boolean caught = false;
try {
target.path("test").request().get(Response.class);
} catch (ResponseProcessingException e) {
caught = true;
assertNotNull(e.getCause());
assertEquals(IOException.class, e.getCause().getClass());
assertEquals(IOExceptionResponseFilter.class.getName(), e.getCause().getMessage());
}
assertTrue(caught);
}
use of javax.ws.rs.client.ResponseProcessingException in project jersey by jersey.
the class EmptyEntityTest method testReceiveEmptyCharacter.
@Test
public void testReceiveEmptyCharacter() {
WebTarget target = target("empty/getempty");
final Response response = target.request("text/plain").get();
assertEquals(200, response.getStatus());
try {
response.readEntity(Character.class);
fail("ProcessingException expected.");
} catch (ProcessingException ex) {
assertSame(NoContentException.class, ex.getCause().getClass());
}
try {
target.request("text/plain").get(Character.class);
fail("ResponseProcessingException expected.");
} catch (ResponseProcessingException ex) {
assertSame(NoContentException.class, ex.getCause().getClass());
}
}
use of javax.ws.rs.client.ResponseProcessingException in project jersey by jersey.
the class EmptyEntityTest method testReceiveEmptyJAXBbean.
@Test
public void testReceiveEmptyJAXBbean() {
WebTarget target = target("empty/getempty");
final Response response = target.request("application/xml").get();
assertEquals(200, response.getStatus());
try {
response.readEntity(TestJaxbBean.class);
fail("ProcessingException expected.");
} catch (ProcessingException ex) {
assertSame(NoContentException.class, ex.getCause().getClass());
}
try {
target.request("application/xml").get(TestJaxbBean.class);
fail("ResponseProcessingException expected.");
} catch (ResponseProcessingException ex) {
assertSame(NoContentException.class, ex.getCause().getClass());
}
}
use of javax.ws.rs.client.ResponseProcessingException in project jersey by jersey.
the class EmptyEntityTest method testReceiveEmptyJAXBlist.
@Test
public void testReceiveEmptyJAXBlist() {
WebTarget target = target("empty/getempty");
final Response response = target.request("application/xml").get();
assertEquals(200, response.getStatus());
try {
response.readEntity(new GenericType<List<TestJaxbBean>>() {
});
fail("ProcessingException expected.");
} catch (ProcessingException ex) {
assertSame(NoContentException.class, ex.getCause().getClass());
}
try {
target.request("application/xml").get(new GenericType<List<TestJaxbBean>>() {
});
fail("ResponseProcessingException expected.");
} catch (ResponseProcessingException ex) {
assertSame(NoContentException.class, ex.getCause().getClass());
}
}
use of javax.ws.rs.client.ResponseProcessingException in project jersey by jersey.
the class EmptyEntityTest method testReceiveEmptyInteger.
@Test
public void testReceiveEmptyInteger() {
WebTarget target = target("empty/getempty");
final Response response = target.request("text/plain").get();
assertEquals(200, response.getStatus());
try {
response.readEntity(Integer.class);
fail("ProcessingException expected.");
} catch (ProcessingException ex) {
assertSame(NoContentException.class, ex.getCause().getClass());
}
try {
target.request("text/plain").get(Integer.class);
fail("ResponseProcessingException expected.");
} catch (ResponseProcessingException ex) {
assertSame(NoContentException.class, ex.getCause().getClass());
}
}
Aggregations