@Test void handleIllegalArgumentException() throws NoSuchMethodException { ResponseEntity<Map> result = service.handleIllegalArgumentException(new IllegalArgumentException("Msg"), new HandlerMethod(service, "toString", null)); ResponseEntity<Map<String, String>> expected = ResponseEntity.status(HttpStatus.BAD_REQUEST).body(getExpected(400, "Msg")); compareBodies(result, expected); }
@ExceptionHandler(IllegalArgumentException.class) public ResponseEntity<Map> handleIllegalArgumentException(IllegalArgumentException ex, HandlerMethod handlerMethod) { log.warn("IllegalArgumentException handled in service: {}, message: {}", handlerMethod.getMethod().getDeclaringClass().getSimpleName(), ex.getMessage()); Map<String, String> body = buildContentMap(400, ex.getMessage()); HttpStatus status = HttpStatus.valueOf(400); return new ResponseEntity<>(body, status); }
TppExceptionAdvisor { @ExceptionHandler(IllegalArgumentException.class) public ResponseEntity<Map> handleIllegalArgumentException(IllegalArgumentException ex, HandlerMethod handlerMethod) { log.warn("IllegalArgumentException handled in service: {}, message: {}", handlerMethod.getMethod().getDeclaringClass().getSimpleName(), ex.getMessage()); Map<String, String> body = buildContentMap(400, ex.getMessage()); HttpStatus status = HttpStatus.valueOf(400); return new ResponseEntity<>(body, status); } }
TppExceptionAdvisor { @ExceptionHandler(IllegalArgumentException.class) public ResponseEntity<Map> handleIllegalArgumentException(IllegalArgumentException ex, HandlerMethod handlerMethod) { log.warn("IllegalArgumentException handled in service: {}, message: {}", handlerMethod.getMethod().getDeclaringClass().getSimpleName(), ex.getMessage()); Map<String, String> body = buildContentMap(400, ex.getMessage()); HttpStatus status = HttpStatus.valueOf(400); return new ResponseEntity<>(body, status); }  }
TppExceptionAdvisor { @ExceptionHandler(IllegalArgumentException.class) public ResponseEntity<Map> handleIllegalArgumentException(IllegalArgumentException ex, HandlerMethod handlerMethod) { log.warn("IllegalArgumentException handled in service: {}, message: {}", handlerMethod.getMethod().getDeclaringClass().getSimpleName(), ex.getMessage()); Map<String, String> body = buildContentMap(400, ex.getMessage()); HttpStatus status = HttpStatus.valueOf(400); return new ResponseEntity<>(body, status); }  @ExceptionHandler(value = Exception.class) ResponseEntity<Map> handleException(Exception ex, HandlerMethod handlerMethod); @ExceptionHandler(TppException.class) ResponseEntity<Map> handleTppException(TppException ex, HandlerMethod handlerMethod); @ExceptionHandler(FeignException.class) ResponseEntity<Map> handleFeignException(FeignException ex, HandlerMethod handlerMethod); @ExceptionHandler(IllegalArgumentException.class) ResponseEntity<Map> handleIllegalArgumentException(IllegalArgumentException ex, HandlerMethod handlerMethod); }
TppExceptionAdvisor { @ExceptionHandler(IllegalArgumentException.class) public ResponseEntity<Map> handleIllegalArgumentException(IllegalArgumentException ex, HandlerMethod handlerMethod) { log.warn("IllegalArgumentException handled in service: {}, message: {}", handlerMethod.getMethod().getDeclaringClass().getSimpleName(), ex.getMessage()); Map<String, String> body = buildContentMap(400, ex.getMessage()); HttpStatus status = HttpStatus.valueOf(400); return new ResponseEntity<>(body, status); }  @ExceptionHandler(value = Exception.class) ResponseEntity<Map> handleException(Exception ex, HandlerMethod handlerMethod); @ExceptionHandler(TppException.class) ResponseEntity<Map> handleTppException(TppException ex, HandlerMethod handlerMethod); @ExceptionHandler(FeignException.class) ResponseEntity<Map> handleFeignException(FeignException ex, HandlerMethod handlerMethod); @ExceptionHandler(IllegalArgumentException.class) ResponseEntity<Map> handleIllegalArgumentException(IllegalArgumentException ex, HandlerMethod handlerMethod);  }