Code example for MockMvc

Methods: perform

0
    } 
 
    @Test 
    public void getDocsPage() throws Exception { 
        mockMvc 
                .perform(get("/docs")) 
                .andExpect(status().isOk()) 
                .andExpect(content().contentTypeCompatibleWith("text/html")) 
                .andExpect(content().string(containsString("Spring Security"))) 
                .andExpect(content().string(containsString("http://docs.spring.io/spring/docs"))); 
    } 
 
    @Test 
    public void doesNotContainAggregatorProjects() throws Exception { 
        mockMvc 
                .perform(get("/docs")) 
                .andExpect(status().isOk()) 
                .andExpect(content().contentTypeCompatibleWith("text/html")) 
                .andExpect(content().string(CoreMatchers.containsString(">Spring Data JPA<"))) 
                .andExpect(content().string(not(CoreMatchers.containsString(">Spring Data<")))); 
Connect your IDE to all the code out there  Get Codota for Java