Spring Framework MockClientHttpRequest - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework MockClientHttpRequest class.

This code example shows how to use the following methods:getBody
 
	private MockClientHttpRequest request; 
 
	@Before 
	public void setUp() throws IOException { 
		this.request = new MockClientHttpRequest(); 
		this.request.getBody().write(RESPONSE_CONTENT.getBytes()); 
	} 
 
	@Test 
	public void value() throws Exception { 
		new JsonPathRequestMatchers("$.foo").value("bar").match(this.request); 
	} 
 
	@Test(expected=AssertionError.class) 
	public void valueNoMatch() throws Exception { 
		new JsonPathRequestMatchers("$.foo").value("bogus").match(this.request); 
	} 
 
	@Test 
7
CodeRank
This code example shows how to use the following methods:getBody
		MockRestRequestMatchers.content().contentType(MediaType.APPLICATION_ATOM_XML).match(this.request); 
	} 
 
	@Test 
	public void testString() throws Exception { 
		this.request.getBody().write("test".getBytes()); 
 
		MockRestRequestMatchers.content().string("test").match(this.request); 
	} 
 
	@Test(expected=AssertionError.class) 
	public void testStringNoMatch() throws Exception { 
		this.request.getBody().write("test".getBytes()); 
 
		MockRestRequestMatchers.content().string("Test").match(this.request); 
	} 
 
	@Test 
	public void testBytes() throws Exception { 
		byte[] content = "test".getBytes(); 
6
CodeRank
This code example shows how to use the following methods:getBody
 
	private MockClientHttpRequest request; 
 
	@Before 
	public void setUp() throws IOException { 
		this.request = new MockClientHttpRequest(); 
		this.request.getBody().write(RESPONSE_CONTENT.getBytes()); 
	} 
 
	@Test 
	public void testNodeMatcher() throws Exception { 
		new XpathRequestMatchers("/foo/bar", null).node(Matchers.notNullValue()).match(this.request); 
	} 
 
	@Test(expected=AssertionError.class) 
	public void testNodeMatcherNoMatch() throws Exception { 
		new XpathRequestMatchers("/foo/bar", null).node(Matchers.nullValue()).match(this.request); 
	} 
 
	@Test 
6
CodeRank
This code example shows how to use the following methods:getHeaders
		MockRestRequestMatchers.method(HttpMethod.GET).match(this.request); 
	} 
 
	@Test 
	public void header() throws Exception { 
		this.request.getHeaders().put("foo", Arrays.asList("bar", "baz")); 
 
		MockRestRequestMatchers.header("foo", "bar", "baz").match(this.request); 
	} 
 
	@Test(expected=AssertionError.class) 
	public void headerMissing() throws Exception { 
		MockRestRequestMatchers.header("foo", "bar").match(this.request); 
	} 
 
	@Test(expected=AssertionError.class) 
	public void headerMissingValue() throws Exception { 
		this.request.getHeaders().put("foo", Arrays.asList("bar", "baz")); 
 
		MockRestRequestMatchers.header("foo", "bad").match(this.request); 
6
CodeRank