notToHaveElementsOrAny

infix fun <E : Any, T : Iterable<E?>> Expect<T>.notToHaveElementsOrAny(assertionCreatorOrNull: Expect<E>.() -> Unit?): Expect<T>(source)

Expects that the subject of this expectation (an Iterable) either has no next element or

Return

an Expect for the subject of this expectation.

Since

1.0.0

Samples

// passes as the list is empty
expect(emptyList<Int>()) notToHaveElementsOrAny { it toBeGreaterThan 1 }

// passes as (at least) one element fulfills the sub expectation
expect(listOf(2, 3, 4)) notToHaveElementsOrAny { it toBeLessThan 3 }
expect(listOf(null, 2, 3)) notToHaveElementsOrAny null

fails {
    expect(listOf(1, 2, 2, 4)) notToHaveElementsOrAny {
        it toBeLessThan 1
    }
}