QueryExceptionMapper implements ExceptionMapper<QueryException> { public Response toResponse(final QueryException exception) { return ErrorResponseBuilder .from(Status.BAD_REQUEST) .build(); }  Response toResponse(final QueryException exception);  }
@Test public void testToResponse() { QueryExceptionMapper mapper = new QueryExceptionMapper(); QueryException e = new QueryException("test"); Response r = mapper.toResponse(e); ErrorResponse er = (ErrorResponse) r.getEntity(); assertEquals(Status.BAD_REQUEST.getStatusCode(), r.getStatus()); assertEquals(Status.BAD_REQUEST, er.getHttpStatus()); assertEquals("Bad Request", er.getErrorDescription()); }