notToHaveElementsOrAll

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

Return

an Expect for the subject of this expectation.

Since

1.0.0

Samples

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

// passes as all elements fulfill the sub expectation
expect(listOf(2, 3, 4)).notToHaveElementsOrAll { toBeGreaterThan(1) }
expect(listOf(null, null)).notToHaveElementsOrAll(null)

fails {
    expect(listOf(1, 2, 2, 4)).notToHaveElementsOrAll {
        toBeLessThanOrEqualTo(3)
    }
}