Interface ValidatableMockMvcResponse
- All Superinterfaces:
io.restassured.response.ValidatableResponseOptions<ValidatableMockMvcResponse,MockMvcResponse>
- All Known Implementing Classes:
ValidatableMockMvcResponseImpl
public interface ValidatableMockMvcResponse
extends io.restassured.response.ValidatableResponseOptions<ValidatableMockMvcResponse,MockMvcResponse>
A validatable response of a request made by REST Assured Mock Mvc.
Usage example:
get("/lotto").then().body("lotto.lottoId", is(5));
-
Method Summary
Modifier and TypeMethodDescriptionapply(org.springframework.test.web.servlet.ResultHandler resultHandler, org.springframework.test.web.servlet.ResultHandler... resultHandlers) Apply one or more result handlers.assertThat(org.springframework.test.web.servlet.ResultMatcher resultMatcher) Assert that aResultMatchermatches the response.expect(org.springframework.test.web.servlet.ResultMatcher resultMatcher) Expect aResultMatcherto match the response.status(org.springframework.http.HttpStatus expectedStatus) Validate that the response status matches an Spring-Framework HttpStatus.Methods inherited from interface io.restassured.response.ValidatableResponseOptions
and, appendRoot, appendRoot, appendRootPath, appendRootPath, assertThat, body, body, body, body, body, body, body, contentType, contentType, contentType, cookie, cookie, cookie, cookie, cookies, cookies, defaultParser, detachRoot, detachRootPath, extract, header, header, header, header, headers, headers, log, noRoot, noRootPath, onFailMessage, parser, root, root, rootPath, rootPath, spec, statusCode, statusCode, statusLine, statusLine, time, time, using
-
Method Details
-
expect
Expect aResultMatcherto match the response.Note same as
assertThat(org.springframework.test.web.servlet.ResultMatcher)but a different syntax.- Parameters:
resultMatcher- The result matcher- Returns:
- The
ValidatableMockMvcResponseinstance.
-
assertThat
ValidatableMockMvcResponse assertThat(org.springframework.test.web.servlet.ResultMatcher resultMatcher) Assert that aResultMatchermatches the response.Note same as
expect(org.springframework.test.web.servlet.ResultMatcher)but a different syntax.- Parameters:
resultMatcher- The result matcher- Returns:
- The
ValidatableMockMvcResponseinstance.
-
apply
ValidatableMockMvcResponse apply(org.springframework.test.web.servlet.ResultHandler resultHandler, org.springframework.test.web.servlet.ResultHandler... resultHandlers) Apply one or more result handlers.- Parameters:
resultHandler- The first result handlerresultHandlers- Additional result handlers to add (optional)- Returns:
- The
ValidatableMockMvcResponseinstance.
-
status
Validate that the response status matches an Spring-Framework HttpStatus. E.g.get("/something").then().assertThat().status(HttpStatus.OK);- Parameters:
expectedStatus- The expected status.- Returns:
- the response specification
-