HomeController { @RequestMapping(value = "error.html") public String error(HttpServletRequest request, Model model) { model.addAttribute( "errorCode", "Error " + request .getAttribute("javax.servlet.error.status_code")); Throwable throwable = (Throwable) request .getAttribute("javax.servlet.error.exception"); StringBuilder errorMessage = new StringBuilder(); errorMessage.append("<ul>"); while (throwable != null) { errorMessage.append("<li>") .append(escapeTags(throwable.getMessage())).append("</li>"); throwable = throwable.getCause(); } errorMessage.append("</ul>"); model.addAttribute("errorMessage", errorMessage.toString()); return "WEB-INF/views/error.html"; }  @RequestMapping(value = "/", method = RequestMethod.GET, produces = "text/html") String home(Model model); @RequestMapping(value = "/keep-alive", method = RequestMethod.GET) @ResponseBody void keepAlive(); @RequestMapping(value = "index.html", method = RequestMethod.GET) String index(Model model, HttpServletRequest request); @RequestMapping(value = "education_center_mainpage.html", method = RequestMethod.GET) String educationMainpage(Model model); @RequestMapping(value = "privacy_consent.html", method = RequestMethod.GET) String privacyConsent(Model model); @RequestMapping(value = "about_consent2share.html", method = RequestMethod.GET) String aboutConsent2Share(Model model); @RequestMapping(value = "information_shared.html", method = RequestMethod.GET) String informationShared(Model model); @RequestMapping(value = "faq_page.html", method = RequestMethod.GET) String faqpage(Model model); @RequestMapping(value = "defaultLoginPage.html", method = RequestMethod.GET) String roleDispatcher(Model model, HttpServletRequest request); @RequestMapping(value = "error.html") String error(HttpServletRequest request, Model model);  }
@Test public void testError() throws Exception { mockMvc.perform(get("/error.html")) .andExpect(view().name("WEB-INF/views/error.html")); }