kotest-assertions-core / io.kotest.matchers.collections / kotlin.collections.Collection / shouldNotBeSingleton

shouldNotBeSingleton

fun <T> Collection<T>.shouldNotBeSingleton(): Unit

Verifies this collection doesn't contain only one element

This assertion is an alias to collection shouldNotHaveSize 1. This will pass if the collection doesn't have exactly one element (definition of a Singleton Collection)

listOf(1, 2).shouldNotBeSingleton()    // Assertion passes
listOf<Int>().shouldNotBeSingleton()   // Assertion passes
listOf(1).shouldNotBeSingleton()       // Assertion fails

See Also

shouldNotHaveSize

shouldBeSingleton

shouldNotHaveSingleElement