use of org.jboss.resteasy.spi.ReaderException in project candlepin by candlepin.
the class ReaderExceptionMapperTest method handleExceptionWithoutResponse.
@Test
public void handleExceptionWithoutResponse() {
ReaderException nfe = new ReaderException("unacceptable");
ReaderExceptionMapper nfem = injector.getInstance(ReaderExceptionMapper.class);
Response r = nfem.toResponse(nfe);
assertEquals(500, r.getStatus());
verifyMessage(r, rtmsg("unacceptable"));
}
use of org.jboss.resteasy.spi.ReaderException in project candlepin by candlepin.
the class ReaderExceptionMapperTest method handleJsonMappingExceptionWithResponse.
@Test
public void handleJsonMappingExceptionWithResponse() {
Response mockr = mock(Response.class);
when(mockr.getStatus()).thenReturn(400);
ReaderException nfe = new ReaderException("kaboom", new JsonMappingException("nope"));
ReaderExceptionMapper nfem = injector.getInstance(ReaderExceptionMapper.class);
Response r = nfem.toResponse(nfe);
assertEquals(400, r.getStatus());
verifyMessage(r, rtmsg("kaboom"));
}
use of org.jboss.resteasy.spi.ReaderException in project candlepin by candlepin.
the class ReaderExceptionMapperTest method handleExceptionWithResponse.
@Test
public void handleExceptionWithResponse() {
Response mockr = mock(Response.class);
when(mockr.getStatus()).thenReturn(400);
ReaderException nfe = new ReaderException("unacceptable", mockr);
ReaderExceptionMapper nfem = injector.getInstance(ReaderExceptionMapper.class);
Response r = nfem.toResponse(nfe);
assertEquals(400, r.getStatus());
verifyMessage(r, rtmsg("unacceptable"));
}
Aggregations