Reputation: 4317
I have an endpoint which returns either true
or false
. Is it somehow possible to tell Hamcrest
with RestAssured
to check whether there exist one of mentioned two ? I've already tried containsString
, hasItems
etc, but none of them works i.e it checks for both of them.
get("http://localhost:8080/trueOrFalse")
.then()
.body(hasItems("true", "false")); // TRUE or FALSE not both
Upvotes: 3
Views: 206
Reputation: 5646
There is an either()
method on the CombinableMatcher class.
Example
assertThat(result, either(is(true)).or(is(false)));
Upvotes: 1