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 list = listOf(1)
val iterator = list.iterator()     // fails as iterator has a next element (has actually one element)

fails {
    expect(iterator).notToHaveNext()
}

iterator.next()                    // returns the next element in iteration
expect(iterator).notToHaveNext()   // returns the next element in iteration

Return
an Expect for the subject of this expectation.

Since
0.17.0