LoginController { @RequestMapping(value = "/login", method = RequestMethod.GET) public ModelAndView login( @RequestParam(value = "error", required = false) String error, @RequestParam(value = "logout", required = false) String logout ) { ModelAndView modelAndView = new ModelAndView(); if(error != null) { modelAndView.addObject("error", "Invalid username and password!"); } if(logout != null) { modelAndView.addObject("msg", "You've been logged out successfully!"); } modelAndView.setViewName("login/login"); return modelAndView; }  @RequestMapping(value = "/login", method = RequestMethod.GET) ModelAndView login(
        @RequestParam(value = "error", required = false) String error,
        @RequestParam(value = "logout", required = false) String logout
    );  }
@Test public void testLogin() { ModelAndView modelAndView = loginController.login(null,null); assertEquals("login/login", modelAndView.getViewName()); }