kotest-assertions-core / io.kotest.matchers.collections / beOneOf

beOneOf

fun <T> beOneOf(collection: Collection<T>): Matcher<T>

Matcher that verifies that this instance is in collection

Assertion to check that this instance is in collection. This matcher checks by reference, and not by value, therefore the exact instance must be in collection, or this will fail.

An empty collection will always fail. If you need to check for empty collection, use Collection.shouldBeEmpty

See Also

shouldBeOneOf

shouldNotBeOneOf