notToHaveElementsOrAll
infix fun <E : Any, T : Iterable<E?>> Expect<T>.notToHaveElementsOrAll(assertionCreatorOrNull: Expect<E>.() -> Unit?): Expect<T>(source)
Expects that the subject of this
expectation (an Iterable) either has no next element or
that all of them hold all expectations the assertionCreatorOrNull creates or
that all of them are
null
in case assertionCreatorOrNull is defined asnull
.
Return
an Expect for the subject of this
expectation.
Since
1.0.0
Samples
// passes as the list is empty
expect(emptyList<Int>()) notToHaveElementsOrAll { it toBeGreaterThan 1 }
// passes as all elements fulfill the sub expectation
expect(listOf(2, 3, 4)) notToHaveElementsOrAll { it toBeGreaterThan 1 }
expect(listOf(null, null)) notToHaveElementsOrAll null
fails {
expect(listOf(1, 2, 2, 4)) notToHaveElementsOrAll {
it toBeLessThanOrEqualTo 3
}
}