fun <E : Any, T : Iterable<E?>> Expect<T>.toHaveElementsAndNone(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>
(source)
Expects that the subject of this
expectation (an Iterable) has next element(s) and
null
in case assertionCreatorOrNull is defined as null
.It is logically equivalent to toHaveNext().notToContain.entry(assertionCreatorOrNull)
expect(listOf(1, 2, 2, 4)).toHaveElementsAndNone {
toEqual(3)
}
fails {
expect(emptyList<Int>()).toHaveElementsAndNone { toEqual(11) }
}
fails {
expect(listOf(1, 2, 2, 4)).toHaveElementsAndNone {
toBeLessThanOrEqualTo(1)
}
}
Return
an Expect for the subject of this
expectation.
Since
0.17.0