@ExceptionHandler({HttpMessageNotReadableException.class})
  @ResponseStatus(HttpStatus.BAD_REQUEST)
  protected ResponseEntity<RestError> handleHttpMessageNotReadableException(HttpMessageNotReadableException httpMessageNotReadableException) {
    String exceptionMessage = getExceptionMessage(httpMessageNotReadableException);
    return new ResponseEntity<>(new RestError(exceptionMessage), HttpStatus.BAD_REQUEST);
  }
@Test
  public void handleHttpMessageNotReadableException_whenCauseIsInvalidFormatException_shouldUseMessageFromCause() {

    InvalidFormatException cause = mock(InvalidFormatException.class);
    when(cause.getOriginalMessage()).thenReturn("Cause message");

    HttpMessageNotReadableException exception = new HttpMessageNotReadableException("Message not readable", cause);

    ResponseEntity<RestError> responseEntity = underTest.handleHttpMessageNotReadableException(exception);

    assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
    assertThat(responseEntity.getBody().message()).isEqualTo("Cause message");
  }