notToHaveElementsOrAny

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 { toBeGreaterThan(1) }

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

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