### Question:
RestExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler({JsonParseException.class, IllegalStateException.class, MismatchedInputException.class}) protected ResponseEntity<Object> handleInvalidBody(RuntimeException ex, WebRequest request) { log.error("Exception during REST request: " + request.getDescription(false), ex); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); ApiError apiError = ApiError.builder() .status(HttpStatus.BAD_REQUEST) .message(ExceptionUtils.getRootCauseMessage(ex)) .build(); return handleExceptionInternal(ex, apiError, headers, HttpStatus.BAD_REQUEST, request); }    }### Answer:
@Test void shouldHandleIllegalArgumentException() { given(webRequest.getDescription(anyBoolean())).willReturn("uri=/test"); ResponseEntity<Object> response = restExceptionHandler .handleInvalidBody(new IllegalArgumentException("Cannot convert JSON"), webRequest); then(response.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST); then(response.getBody()).satisfies(body -> { ApiError error = (ApiError) body; then(error.getStatus()).isEqualTo(HttpStatus.BAD_REQUEST); then(error.getMessage()).isEqualTo("IllegalArgumentException: Cannot convert JSON"); }); }