Is there a way to check that an object is an element of some collection with AssertJ? Something like
assertThat(actualObject).isElementOf(collectionWithExpectedOptions);
I could do
assertThat(collectionWithExpectedOptions).contains(actualObject);
But I think there is a convention that the argument of assertThat()
should be the actual rather than the expected thing.
try isIn
:
Iterable<Ring> elvesRings = list(vilya, nenya, narya);
// assertion will pass:
assertThat(nenya).isIn(elvesRings);