T - The type of the response.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 ResponseAwareMatcher() {
public Matcher extends Object> matcher(Response response) {
return equalTo("http://localhost:8080/" + response.path("userId"));
}
});
ResponseAwareMatchers are also composable with other ResponseAwareMatchers and other Hamcrest matchers.
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–2015. All rights reserved.