next

object next : Keyword(source)

Represents the pseudo keyword next as in toHave next. It can be used for a parameterless function so that it has one parameter and thus can be used as infix function.

Since

0.12.0

Samples

val list = listOf(1)
val iterator = list.iterator()
expect(iterator) toHave next      // holds as iterator has a next element

fails {
    iterator.next()               // returns the next element in iteration
    expect(iterator) toHave next  // fails as list has only 1 element, i.e. no next any more.
}