HomeController { @RequestMapping(value = "/", method = RequestMethod.GET, produces = "text/html") public String home(Model model) { Authentication auth = SecurityContextHolder.getContext() .getAuthentication(); if (!(auth instanceof AnonymousAuthenticationToken)) { return "redirect:/defaultLoginPage.html"; } return "views/index"; }  @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 testHome() throws Exception { mockMvc.perform(get("/")) .andExpect(view().name("redirect:/defaultLoginPage.html")); }