Code example for ModelAndView

Methods: getViewName

0
        when(userService.getCurrentUser()).thenReturn(new JCUser("username", null, null)); 
        when(request.getHeader("referer")).thenReturn(referer); 
 
        ModelAndView mav = userController.loginPage(request); 
 
        assertEquals(mav.getViewName(), "redirect:" + referer); 
        verify(userService).getCurrentUser(); 
    } 
 
    @Test 
    public void testLoginUserNotLogged() { 
        when(userService.getCurrentUser()).thenReturn(new AnonymousUser()); 
 
        ModelAndView mav = userController.loginPage(request); 
 
        assertEquals(mav.getViewName(), UserController.LOGIN); 
        verify(userService).getCurrentUser(); 
    } 
 
    @DataProvider