RollbarHandlerExceptionResolver implements HandlerExceptionResolver { @Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { rollbar.error(ex); return null; } @Autowired  RollbarHandlerExceptionResolver(Rollbar rollbar); @Override ModelAndView resolveException(HttpServletRequest request,
                                     HttpServletResponse response,
                                     Object handler,
                                     Exception ex);  }
@Test public void testRollbarExceptionResolver() { Exception testException = new Exception("test exception"); Rollbar rollbar = mock(Rollbar.class); doNothing().when(rollbar).error(testException); HandlerExceptionResolver handlerExceptionResolver = new RollbarHandlerExceptionResolver(rollbar); handlerExceptionResolver.resolveException(request, response, null, testException); verify(rollbar, times(1)).error(testException); }