Code example for MockMvc

Methods: perform

0
        assertNotNull(session.getAttribute(BaseFormController.MESSAGES_KEY)); 
    } 
 
    @Test 
    public void testShowUpdatePasswordForm() throws Exception { 
        mockMvc.perform(get("/updatePassword").param("username", "admin")) 
            .andExpect(status().isOk()) 
            .andExpect(view().name("updatePasswordForm")); 
    } 
 
    @Test 
    public void testShowResetPasswordForm() throws Exception { 
        String username = "admin"; 
        User user = userManager.getUserByUsername(username); 
        String token = userManager.generateRecoveryToken(user); 
 
        ResultActions update = mockMvc.perform(get("/updatePassword") 
            .param("username", username).param("token", token)) 
            .andExpect(status().isOk()) 
            .andExpect(view().name("updatePasswordForm"));