LoginController { @GetMapping("/login") public ModelAndView login() { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("login"); 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 testLogin() throws Exception { this.mockMvc.perform(get("/login")).andExpect(status().isOk()).andExpect(view().name("login")) .andExpect(content().contentType("text/html;charset=UTF-8")); }