notToHaveNext

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

Return

an Expect for the subject of this expectation.

Since

0.17.0

Samples

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