Code example for MockMvc

Methods: perform

0
	@Test 
	public void handsLinkHeadersIntoControllerMethod() throws Exception { 
 
		Link link = new Link("/something"); 
 
		mvc.perform(get("/links").header("Link", link.toString())). // 
				andExpect(header().string("Link", link.toString())). // 
				andExpect(content().string("Result")); 
	} 
 
	@Controller 
	static class LinkHeaderController { 
 
		@RequestMapping("/links") 
		HttpEntity<?> linkHeaders(@RequestHeader("Link") Links links) { 
 
			HttpHeaders headers = new HttpHeaders(); 
			headers.add("Link", links.toString()); 
 
			return new ResponseEntity<String>("Result", headers, HttpStatus.OK); 
Connect your IDE to all the code out there  Get Codota for Java