I have the following simple controller to catch any unexpected exceptions:
@ControllerAdvice
public class ExceptionController {
@ExceptionHandler(Throwa
I had the same issue; This worked for me:
*RuntimeException in thenThrow(); ErrorHandler won't catch Exception or Throwable parent classes.
*Remove all try-catch sentences of methods being tested
*No @Before or @ComponentScan annotations were needed at all
when(getRejectionQuery.execute(anyInt(), anyInt(), anyMap())).thenThrow(new RuntimeException());