Interface MockMvcResponse
- All Superinterfaces:
io.restassured.response.ResponseBody<MockMvcResponse>,io.restassured.response.ResponseBodyData,io.restassured.response.ResponseBodyExtractionOptions,io.restassured.response.ResponseOptions<MockMvcResponse>,io.restassured.response.Validatable<ValidatableMockMvcResponse,MockMvcResponse>
- All Known Implementing Classes:
MockMvcRestAssuredResponseImpl
public interface MockMvcResponse
extends io.restassured.response.ResponseBody<MockMvcResponse>, io.restassured.response.ResponseOptions<MockMvcResponse>, io.restassured.response.Validatable<ValidatableMockMvcResponse,MockMvcResponse>
The response of a request made by REST Assured Mock MVC.
Usage example:
Response response = get("/lotto");
String body = response.getBody().asString();
String headerValue = response.getHeader("headerName");
String cookieValue = response.getCookie("cookieName");
You can also map the response body to a Java object automatically. REST Assured will use Jackson, Gson and JAXB to accommodate this:
Message message = get("/message").as(Message.class);
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.mock.web.MockHttpServletResponseReturn theMockHttpServletResponseas returned by Spring MockMvc.org.springframework.test.web.servlet.MvcResultReturn theMvcResultas returned by Spring MockMvc.org.springframework.mock.web.MockHttpServletResponseReturn theMockHttpServletResponseas returned by Spring MockMvc.org.springframework.test.web.servlet.MvcResultReturn theMvcResultas returned by Spring MockMvc.Methods inherited from interface io.restassured.response.ResponseBody
peek, prettyPeek, prettyPrint, printMethods inherited from interface io.restassured.response.ResponseBodyData
asByteArray, asInputStream, asPrettyString, asStringMethods inherited from interface io.restassured.response.ResponseBodyExtractionOptions
as, as, as, as, as, as, as, htmlPath, jsonPath, jsonPath, path, xmlPath, xmlPath, xmlPathMethods inherited from interface io.restassured.response.ResponseOptions
andReturn, body, contentType, cookie, cookies, detailedCookie, detailedCookies, getBody, getContentType, getCookie, getCookies, getDetailedCookie, getDetailedCookies, getHeader, getHeaders, getSessionId, getStatusCode, getStatusLine, getTime, getTimeIn, header, headers, sessionId, statusCode, statusLine, thenReturn, time, timeInMethods inherited from interface io.restassured.response.Validatable
then
-
Method Details
-
mvcResult
org.springframework.test.web.servlet.MvcResult mvcResult()Return theMvcResultas returned by Spring MockMvc.This method is the same as
getMvcResult()except for syntactic differences.- Returns:
- The
MvcResultas returned by Spring MockMvc.
-
getMvcResult
org.springframework.test.web.servlet.MvcResult getMvcResult()Return theMvcResultas returned by Spring MockMvc.This method is the same as
mvcResult()except for syntactic differences.- Returns:
- The
MvcResultas returned by Spring MockMvc.
-
mockHttpServletResponse
org.springframework.mock.web.MockHttpServletResponse mockHttpServletResponse()Return theMockHttpServletResponseas returned by Spring MockMvc.This method is the same as
getMockHttpServletResponse()except for syntactic differences.- Returns:
- The
MockHttpServletResponseas returned by Spring MockMvc.
-
getMockHttpServletResponse
org.springframework.mock.web.MockHttpServletResponse getMockHttpServletResponse()Return theMockHttpServletResponseas returned by Spring MockMvc.This method is the same as
mockHttpServletResponse()except for syntactic differences.- Returns:
- The
MockHttpServletResponseas returned by Spring MockMvc.
-