Code example for MockMvc

Methods: perform

0
  @Test 
   public void cdmRemoteRequestCapabilitiesTest() throws Exception { 
     RequestBuilder rb = MockMvcRequestBuilders.get(path).servletPath(path) 
   				.param("req", "capabilities"); 
 
     MvcResult result = this.mockMvc.perform( rb ) 
               .andExpect(MockMvcResultMatchers.status().is(200)) 
               .andExpect(MockMvcResultMatchers.content().contentType(ContentType.xml.getContentHeader())) 
               .andReturn(); 
 
    //System.out.printf("content = %s%n", result.getResponse().getContentAsString()); 
 
    /* String content = 
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+ 
            "<cdmRemoteCapabilities location=\"http://localhost:80/cdmremote/NCOF/POLCOMS/IRISH_SEA/files/20060925_0600.nc\">"+ 
            "  <featureDataset type=\"GRID\" url=\"http://localhost:80/cdmremote/NCOF/POLCOMS/IRISH_SEA/files/20060925_0600.nc\" />"+ 
            "</cdmRemoteCapabilities>";  // LAME 
 
    assert content.equals(result.getResponse().getContentAsString());  */ 
   } 
Contextual code suggestions in your IDE  Get Codota for Java