AssertJ - 如何检查元素是否在集合中?

AssertJ - how to check that an element is in a collection?

有没有办法用 AssertJ 检查对象是否是某个集合的元素?像

assertThat(actualObject).isElementOf(collectionWithExpectedOptions);

我可以

assertThat(collectionWithExpectedOptions).contains(actualObject);

但我认为assertThat()的参数应该是实际的而不是预期的。

尝试isIn:

Iterable<Ring> elvesRings = list(vilya, nenya, narya);

// assertion will pass:
assertThat(nenya).isIn(elvesRings);