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

shouldBeOneOf

infix fun <T> T.shouldBeOneOf(collection: Collection<T>): Unit

Verifies that this instance is in collection

Assertion to check that this instance is in collection. This assertion 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

shouldNotBeOneOf

beOneOf

fun <T> T.shouldBeOneOf(vararg any: T): Unit

Verifies that this instance is any of any

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

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

See Also

shouldNotBeOneOf

beOneOf