doc / ch.tutteli.atrium.api.fluent.en_GB / notToHaveNext

notToHaveNext

fun <T : Iterator<*>> Expect<T>.notToHaveNext(): Expect<T> (source)

Expects that the subject of this expectation (an Iterator) does not have a next element.

val iterator = listOf(1).iterator()

fails {
    expect(iterator).notToHaveNext() // fails as iterator has a next element (has actually one element)
}

iterator.next()                      // returns the next element in iteration
expect(iterator).notToHaveNext()     // does not fail as by now iterator has no next element

Return
an Expect for the subject of this expectation.

Since
0.17.0