Code example for MockMvc

Methods: perform

0
	@Test 
	public void testDto() throws Exception { 
 
		String jsonContent = "{\"id\":1,\"value1\":\"foo\",\"value2\":\"bar\"}"; 
 
		this.mockMvc.perform(post("/testcontroller2/test2") 
				.content(jsonContent)) 
				.andExpect(status().isOk()) 
				.andExpect(content().string(jsonContent)); 
	} 
 
	@Test 
	public void testDtoLists() throws Exception { 
 
		String jsonContent = 
				"[{\"id\":1,\"value1\":\"foo1\",\"value2\":\"bar1\"}," + 
				"{\"id\":2,\"value1\":\"foo2\",\"value2\":\"bar2\"}," + 
				"{\"id\":3,\"value1\":\"foo3\",\"value2\":\"bar3\"}]"; 
 
		this.mockMvc.perform(post("/testcontroller2/test2List") 
Connect your IDE to all the code out there  Get Codota for Java