### Question:
PollController { @ExceptionHandler(AccessDeniedException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public ModelAndView handleAllExceptions(Exception exception) { MappingJacksonJsonView jsonView = new MappingJacksonJsonView(); ModelAndView mav = new ModelAndView(jsonView); mav.addObject(ERROR_MESSAGE_PARAMETER, exception.getMessage()); return mav; } @Autowired  PollController(PollService pollService); @RequestMapping(value = "/poll/{pollId}/single", method = RequestMethod.POST) @ResponseBody PollDto addSingleVote(@PathVariable Long pollId, @RequestParam Long pollOptionId); @RequestMapping(value = "/poll/{pollId}/multiple", method = RequestMethod.POST) @ResponseBody PollDto addMultipleVote(@PathVariable Long pollId, @RequestBody PollDto pollDto); @ExceptionHandler(AccessDeniedException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) ModelAndView handleAllExceptions(Exception exception);  }### Answer:
@Test public void testHandleAllExceptions() { Exception exception = new Exception("Some message"); ModelAndView mav = pollController.handleAllExceptions(exception); assertTrue(mav.getView() instanceof MappingJacksonJsonView); assertEquals(mav.getModel().get("errorMessage"), exception.getMessage()); }