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

shouldBeIn

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

Verifies that this element is in collection by comparing value

Assertion to check that this element is in collection. This assertion checks by value, and not by reference, therefore even if the exact instance is not in collection but another instance with same value is present, the test will pass.

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

See Also

shouldNotBeIn

beIn

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

Verifies that this element is any of any by comparing value

Assertion to check that this element is any of any. This assertion checks by value, and not by reference, therefore even if the exact instance is not any of any but another instance with same value is present, the test will pass.

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

See Also

shouldNotBeIn

beIn