WebApplicationExceptionMapper extends CandlepinExceptionMapper implements ExceptionMapper<WebApplicationException> { @Override public Response toResponse(WebApplicationException exception) { return getDefaultBuilder(exception, Response.Status.fromStatusCode( exception.getResponse().getStatus()), determineBestMediaType()).build(); }  @Override Response toResponse(WebApplicationException exception);  }
@Test public void handleExceptionWithResponse() { Response mockr = mock(Response.class); when(mockr.getStatus()).thenReturn(500); when(mockr.getStatusInfo()).thenReturn(Status.INTERNAL_SERVER_ERROR); WebApplicationException nfe = new WebApplicationException(mockr); WebApplicationExceptionMapper nfem = injector.getInstance(WebApplicationExceptionMapper.class); Response r = nfem.toResponse(nfe); assertEquals(500, r.getStatus()); verifyMessage(r, rtmsg("")); }