Code example for MockMvc

Methods: perform

0
        mockMvc = MockMvcBuilders.standaloneSetup(controller).build(); 
    } 
 
    @Test 
    public void testDisplayForm() throws Exception { 
        mockMvc.perform(get("/signup.html")) 
            .andExpect(status().isOk()) 
            .andExpect(model().attributeExists("user")); 
    } 
 
    @Test 
    public void testSignupUser() throws Exception { 
        // start SMTP Server 
        Wiser wiser = new Wiser(); 
        wiser.setPort(getSmtpPort()); 
        wiser.start(); 
 
        ResultActions signup = mockMvc.perform(post("/signup.html") 
                .param("address.city", "Denver") 
                .param("address.province", "Colorado")