@Test public void itShouldMapEntityNotFoundException() { EntityNotFoundException entityNotFoundException = new EntityNotFoundException( Event.class, TestConstants.EVENT_ID ); Response actual = mapper.toResponse(entityNotFoundException); assertThat(actual.getStatus()).isEqualTo(HttpStatus.NOT_FOUND_404); }
@Override public Response toResponse(DomainServiceException exception) { final int status = this.status.get(exception.getClass()); return Response.status(status) .type(MediaType.APPLICATION_JSON_TYPE) .entity(new ErrorMessage(status, exception.getMessage())) .build(); }
DomainServiceExceptionMapper implements ExceptionMapper<DomainServiceException> { @Override public Response toResponse(DomainServiceException exception) { final int status = this.status.get(exception.getClass()); return Response.status(status) .type(MediaType.APPLICATION_JSON_TYPE) .entity(new ErrorMessage(status, exception.getMessage())) .build(); } }
DomainServiceExceptionMapper implements ExceptionMapper<DomainServiceException> { @Override public Response toResponse(DomainServiceException exception) { final int status = this.status.get(exception.getClass()); return Response.status(status) .type(MediaType.APPLICATION_JSON_TYPE) .entity(new ErrorMessage(status, exception.getMessage())) .build(); } @Inject  DomainServiceExceptionMapper(); }
DomainServiceExceptionMapper implements ExceptionMapper<DomainServiceException> { @Override public Response toResponse(DomainServiceException exception) { final int status = this.status.get(exception.getClass()); return Response.status(status) .type(MediaType.APPLICATION_JSON_TYPE) .entity(new ErrorMessage(status, exception.getMessage())) .build(); } @Inject  DomainServiceExceptionMapper(); @Override Response toResponse(DomainServiceException exception); }
DomainServiceExceptionMapper implements ExceptionMapper<DomainServiceException> { @Override public Response toResponse(DomainServiceException exception) { final int status = this.status.get(exception.getClass()); return Response.status(status) .type(MediaType.APPLICATION_JSON_TYPE) .entity(new ErrorMessage(status, exception.getMessage())) .build(); } @Inject  DomainServiceExceptionMapper(); @Override Response toResponse(DomainServiceException exception);  }