@Test public void toResponse() { final String message = "What are you talking about Willis?!?"; final NotFoundException exception = new NotFoundException(message); final Response response = mapper.toResponse(exception); assertThat(response.getStatus()).isEqualTo(404); assertThat(response.getEntity()).isEqualTo(message); }
@Override public Response toResponse(final NotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); }
NotFoundExceptionMapper implements ExceptionMapper<NotFoundException> { @Override public Response toResponse(final NotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); } }
NotFoundExceptionMapper implements ExceptionMapper<NotFoundException> { @Override public Response toResponse(final NotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); }  }
NotFoundExceptionMapper implements ExceptionMapper<NotFoundException> { @Override public Response toResponse(final NotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); }  @Override Response toResponse(final NotFoundException ex); }
NotFoundExceptionMapper implements ExceptionMapper<NotFoundException> { @Override public Response toResponse(final NotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); }  @Override Response toResponse(final NotFoundException ex);  }