ApplicationExceptionMapper extends CandlepinExceptionMapper implements ExceptionMapper<ApplicationException> { @Override public Response toResponse(ApplicationException exception) { return getDefaultBuilder(exception, null, determineBestMediaType()).build(); }  @Override Response toResponse(ApplicationException exception);  }
@Test public void withCause() { EOFException eofe = new EOFException("screwed"); ApplicationException ae = new ApplicationException("oops", eofe); ApplicationExceptionMapper aem = injector.getInstance(ApplicationExceptionMapper.class); Response r = aem.toResponse(ae); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus()); verifyMessage(r, rtmsg("oops")); }
@Test public void noCause() { ApplicationException ae = new ApplicationException("oops", null); ApplicationExceptionMapper aem = injector.getInstance(ApplicationExceptionMapper.class); Response r = aem.toResponse(ae); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus()); verifyMessage(r, rtmsg("oops")); }