@Test public void should_convert_exception_to_response() throws Exception { String message = "certificate is empty"; IllegalArgumentException illegalArgumentException = new IllegalArgumentException(message); Response response = illegalArgumentExceptionMapper.toResponse(illegalArgumentException); assertThat(response.getStatusInfo()).isEqualTo(BAD_REQUEST); assertThat(response.getEntity()).isEqualTo(message); }
@Override public Response toResponse(IllegalArgumentException exception) { LOGGER.error(exception); return Response.status(Response.Status.BAD_REQUEST).entity(exception.getMessage()).build(); }
IllegalArgumentExceptionMapper implements ExceptionMapper<IllegalArgumentException> { @Override public Response toResponse(IllegalArgumentException exception) { LOGGER.error(exception); return Response.status(Response.Status.BAD_REQUEST).entity(exception.getMessage()).build(); } }
IllegalArgumentExceptionMapper implements ExceptionMapper<IllegalArgumentException> { @Override public Response toResponse(IllegalArgumentException exception) { LOGGER.error(exception); return Response.status(Response.Status.BAD_REQUEST).entity(exception.getMessage()).build(); }  }
IllegalArgumentExceptionMapper implements ExceptionMapper<IllegalArgumentException> { @Override public Response toResponse(IllegalArgumentException exception) { LOGGER.error(exception); return Response.status(Response.Status.BAD_REQUEST).entity(exception.getMessage()).build(); }  @Override Response toResponse(IllegalArgumentException exception); }
IllegalArgumentExceptionMapper implements ExceptionMapper<IllegalArgumentException> { @Override public Response toResponse(IllegalArgumentException exception) { LOGGER.error(exception); return Response.status(Response.Status.BAD_REQUEST).entity(exception.getMessage()).build(); }  @Override Response toResponse(IllegalArgumentException exception);  }