@Test public void testHandleException() throws Exception { executeWithoutLogging(HerdUiControllerAdvice.class, new Command() { @Override public void execute() { // Non-user exceptions should only contain the view and no message in the model. // Calling handleException will log a stack trace which is normal so don't be concerned if you see it in the logs. ModelAndView modelAndView = controllerAdvice.handleException(new Exception(MESSAGE)); assertTrue(UiConstants.DISPLAY_ERROR_MESSAGE_PAGE.equals(modelAndView.getViewName())); assertNull(modelAndView.getModel().get(UiConstants.MODEL_KEY_MESSAGE)); } }); }