@Test public void toResponse() { final KeyNotFoundException keyNotFoundException = new KeyNotFoundException("OUCH"); final Response result = instance.toResponse(keyNotFoundException); assertThat(result).isNotNull(); final String message = (String) result.getEntity(); assertThat(message).isEqualTo("OUCH"); assertThat(result.getStatus()).isEqualTo(404); }
@Override public Response toResponse(final KeyNotFoundException e) { LOGGER.warn(e.getMessage()); LOGGER.debug(null, e); return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_PLAIN).build(); }
KeyNotFoundExceptionMapper implements ExceptionMapper<KeyNotFoundException> { @Override public Response toResponse(final KeyNotFoundException e) { LOGGER.warn(e.getMessage()); LOGGER.debug(null, e); return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_PLAIN).build(); } }
KeyNotFoundExceptionMapper implements ExceptionMapper<KeyNotFoundException> { @Override public Response toResponse(final KeyNotFoundException e) { LOGGER.warn(e.getMessage()); LOGGER.debug(null, e); return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_PLAIN).build(); }  }
KeyNotFoundExceptionMapper implements ExceptionMapper<KeyNotFoundException> { @Override public Response toResponse(final KeyNotFoundException e) { LOGGER.warn(e.getMessage()); LOGGER.debug(null, e); return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_PLAIN).build(); }  @Override Response toResponse(final KeyNotFoundException e); }
KeyNotFoundExceptionMapper implements ExceptionMapper<KeyNotFoundException> { @Override public Response toResponse(final KeyNotFoundException e) { LOGGER.warn(e.getMessage()); LOGGER.debug(null, e); return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_PLAIN).build(); }  @Override Response toResponse(final KeyNotFoundException e);  }