@Test public void itShouldMapEntityMismatchException() { EntityMismatchException entityMismatchException = new EntityMismatchException(); Response actual = mapper.toResponse(entityMismatchException); assertThat(actual.getStatus()).isEqualTo(HttpStatus.CONFLICT_409); }
@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);  }