NullPointerExceptionMapper implements ExceptionMapper<NullPointerException> { @Override public Response toResponse(NullPointerException exception) { return Response.status(Response.Status.BAD_REQUEST).build(); }  @Override Response toResponse(NullPointerException exception);  }
@Test public void toResponse() { NullPointerExceptionMapper mapper = new NullPointerExceptionMapper(); NullPointerException npe = new NullPointerException("Null Pointer"); Response r = mapper.toResponse(npe); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), r.getStatus()); }