doc / ch.tutteli.atrium.api.infix.en_GB / next

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.

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.
}

Since
0.12.0