use of org.springframework.test.web.servlet.StubMvcResult in project spring-framework by spring-projects.
the class JsonPathResultMatchersTests method prefixWithPayloadNotLongEnough.
@Test(expected = AssertionError.class)
public void prefixWithPayloadNotLongEnough() throws Exception {
MockHttpServletResponse response = new MockHttpServletResponse();
response.addHeader("Content-Type", "application/json");
response.getWriter().print(new String("test".getBytes("ISO-8859-1")));
StubMvcResult result = new StubMvcResult(null, null, null, null, null, null, response);
new JsonPathResultMatchers("$.str").prefix("prefix").value("foo").match(result);
}
use of org.springframework.test.web.servlet.StubMvcResult in project spring-framework by spring-projects.
the class JsonPathResultMatchersTests method createPrefixedStubMvcResult.
private StubMvcResult createPrefixedStubMvcResult(String jsonPrefix) throws Exception {
MockHttpServletResponse response = new MockHttpServletResponse();
response.addHeader("Content-Type", "application/json");
response.getWriter().print(jsonPrefix + new String(RESPONSE_CONTENT.getBytes("ISO-8859-1")));
return new StubMvcResult(null, null, null, null, null, null, response);
}
use of org.springframework.test.web.servlet.StubMvcResult in project spring-framework by spring-projects.
the class MockMvcResultMatchersTests method getForwardedUrlStubMvcResult.
private StubMvcResult getForwardedUrlStubMvcResult(String forwardedUrl) {
MockHttpServletResponse response = new MockHttpServletResponse();
response.setForwardedUrl(forwardedUrl);
StubMvcResult mvcResult = new StubMvcResult(null, null, null, null, null, null, response);
return mvcResult;
}
use of org.springframework.test.web.servlet.StubMvcResult in project spring-framework by spring-projects.
the class MockMvcResultMatchersTests method getRedirectedUrlStubMvcResult.
private StubMvcResult getRedirectedUrlStubMvcResult(String redirectUrl) throws Exception {
MockHttpServletResponse response = new MockHttpServletResponse();
response.sendRedirect(redirectUrl);
StubMvcResult mvcResult = new StubMvcResult(null, null, null, null, null, null, response);
return mvcResult;
}
Aggregations