@Test public void testMissingRequiredParameter() { MissingRequiredParameterException ex = new MissingRequiredParameterException("Missing parameter"); assertEquals(HttpStatus.BAD_REQUEST, exceptionHandler.handleMissingRequiredParameterException(ex).getStatusCode()); }
@ResponseBody @ExceptionHandler(MissingRequiredParameterException.class) public ResponseEntity<ErrorResponse> handleMissingRequiredParameterException(MissingRequiredParameterException ex) { ErrorResponse response = new ErrorResponse(HttpStatus.BAD_REQUEST.value(), ex.getMessage()); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response); }
WebResourceExceptionHandler { @ResponseBody @ExceptionHandler(MissingRequiredParameterException.class) public ResponseEntity<ErrorResponse> handleMissingRequiredParameterException(MissingRequiredParameterException ex) { ErrorResponse response = new ErrorResponse(HttpStatus.BAD_REQUEST.value(), ex.getMessage()); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response); } }
WebResourceExceptionHandler { @ResponseBody @ExceptionHandler(MissingRequiredParameterException.class) public ResponseEntity<ErrorResponse> handleMissingRequiredParameterException(MissingRequiredParameterException ex) { ErrorResponse response = new ErrorResponse(HttpStatus.BAD_REQUEST.value(), ex.getMessage()); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response); }  }
WebResourceExceptionHandler { @ResponseBody @ExceptionHandler(MissingRequiredParameterException.class) public ResponseEntity<ErrorResponse> handleMissingRequiredParameterException(MissingRequiredParameterException ex) { ErrorResponse response = new ErrorResponse(HttpStatus.BAD_REQUEST.value(), ex.getMessage()); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response); }  @ResponseBody @ExceptionHandler(IntegrationUnavailableException.class) ResponseEntity<ErrorResponse> handleUnavailableException(IntegrationUnavailableException ex); @ResponseBody @ExceptionHandler({RemoteApiException.class}) ResponseEntity<ErrorResponse> handleRemoteAPIException(RemoteApiException ex); @ResponseBody @ExceptionHandler(UnauthorizedUserException.class) ResponseEntity<ErrorResponse> handleUnauthorizedException(UnauthorizedUserException ex); @ResponseBody @ExceptionHandler({ ForbiddenAuthException.class, UnregisteredAppAuthException.class }) ResponseEntity<ErrorResponse> handleForbiddenException(AuthenticationException ex); @ResponseBody @ExceptionHandler(MissingRequiredParameterException.class) ResponseEntity<ErrorResponse> handleMissingRequiredParameterException(MissingRequiredParameterException ex); }
WebResourceExceptionHandler { @ResponseBody @ExceptionHandler(MissingRequiredParameterException.class) public ResponseEntity<ErrorResponse> handleMissingRequiredParameterException(MissingRequiredParameterException ex) { ErrorResponse response = new ErrorResponse(HttpStatus.BAD_REQUEST.value(), ex.getMessage()); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response); }  @ResponseBody @ExceptionHandler(IntegrationUnavailableException.class) ResponseEntity<ErrorResponse> handleUnavailableException(IntegrationUnavailableException ex); @ResponseBody @ExceptionHandler({RemoteApiException.class}) ResponseEntity<ErrorResponse> handleRemoteAPIException(RemoteApiException ex); @ResponseBody @ExceptionHandler(UnauthorizedUserException.class) ResponseEntity<ErrorResponse> handleUnauthorizedException(UnauthorizedUserException ex); @ResponseBody @ExceptionHandler({ ForbiddenAuthException.class, UnregisteredAppAuthException.class }) ResponseEntity<ErrorResponse> handleForbiddenException(AuthenticationException ex); @ResponseBody @ExceptionHandler(MissingRequiredParameterException.class) ResponseEntity<ErrorResponse> handleMissingRequiredParameterException(MissingRequiredParameterException ex);  }