@Test public void toResponse() { final String message = "OUCH That's gotta smart!!"; final EntityNotFoundException exception = new EntityNotFoundException(message); final Response result = instance.toResponse(exception); assertThat(result).isNotNull(); assertThat(result.getStatus()).isEqualTo(404); assertThat(result.getEntity()).isEqualTo(message); }
@Override public Response toResponse(final EntityNotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Response.Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); }
EntityNotFoundExceptionMapper implements ExceptionMapper<EntityNotFoundException> { @Override public Response toResponse(final EntityNotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Response.Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); } }
EntityNotFoundExceptionMapper implements ExceptionMapper<EntityNotFoundException> { @Override public Response toResponse(final EntityNotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Response.Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); }  }
EntityNotFoundExceptionMapper implements ExceptionMapper<EntityNotFoundException> { @Override public Response toResponse(final EntityNotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Response.Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); }  @Override Response toResponse(final EntityNotFoundException ex); }
EntityNotFoundExceptionMapper implements ExceptionMapper<EntityNotFoundException> { @Override public Response toResponse(final EntityNotFoundException ex) { LOGGER.warn("Entity not found: {}", ex.getMessage()); LOGGER.debug(null, ex); return Response.status(Response.Status.NOT_FOUND).entity(ex.getMessage()).type(MediaType.TEXT_PLAIN).build(); }  @Override Response toResponse(final EntityNotFoundException ex);  }