HibernateExceptionMapper implements ExceptionMapper<HibernateException> { public Response toResponse(final HibernateException exception) { return ErrorResponseBuilder .from(exception) .build(); }  Response toResponse(final HibernateException exception);  }
@Test public void testToResponse() { HibernateExceptionMapper mapper = new HibernateExceptionMapper(); HibernateException e = new HibernateException("test"); Response r = mapper.toResponse(e); ErrorResponse er = (ErrorResponse) r.getEntity(); assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus()); assertEquals(Status.INTERNAL_SERVER_ERROR, er.getHttpStatus()); assertEquals("Internal Server Error", er.getErrorDescription()); }