LoginController { @GetMapping({ "/", "/home" }) public ModelAndView home() { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("home"); return modelAndView; } LoginController(CustomUserDetailsServiceImpl userService); @GetMapping("/login") ModelAndView login(); @GetMapping("/signup") ModelAndView signup(); @PostMapping("/signup") ModelAndView createNewUser(@Valid @ModelAttribute User user, BindingResult bindingResult); @GetMapping("/dashboard") ModelAndView dashboard(); @GetMapping({ "/", "/home" }) ModelAndView home();  }
@Test void testHome() throws Exception { this.mockMvc.perform(get("/")).andExpect(status().isOk()).andExpect(view().name("home")) .andExpect(content().contentType("text/html;charset=UTF-8")); }