not(hasItems()) does not seem to work when multiple items are passed

40 views
Skip to first unread message

Kuzhali Velmurugan

unread,
Feb 23, 2016, 7:24:12 AM2/23/16
to Hamcrest Java Users
Hello,

Below is the scenario where am facing an issue. Here I am asserting that few Id's are not present:

given().param(param1, type)
.get(
"/API").then().log().ifValidationFails()
.body(
"entries.id", hasItems(id2, id3))
.body(
"entries.id", not(hasItems(id1, id2)))
.body(
SUCCESS, equalTo(true))
.assertThat().statusCode(
200);

It is expected to fail at not(hasItems(id1, id2)), as id2 is present. But the test seems to pass.
But not(hasItems()) seems to work fine when single Id is passed.


Thanks,
Kuzhali

Reply all
Reply to author
Forward
0 new messages