T
- The type of the response.@FunctionalInterface public interface ResponseAwareMatcher<T extends ResponseBody<T> & ResponseOptions<T>>
Matcher
based on the contents of a response. For example imagine that a
resource "/x" returns the following JSON document:
{ "userId" : "my-id", "href" : "http://localhost:8080/my-id" }you can then verify the href using:
get("/x").then().body("href", new ResponseAwareMatcherResponseAwareMatchers are also composable with other ResponseAwareMatchers and other Hamcrest matchers.() { public Matcher extends Object> matcher(Response response) { return equalTo("http://localhost:8080/" + response.path("userId")); } });
Note that you can also use some of the predefined methods in RestAssuredMatchers
.
Modifier and Type | Method and Description |
---|---|
org.hamcrest.Matcher<?> |
matcher(T response)
Create the matcher based on the content of the response.
|
Copyright © 2010–2020. All rights reserved.