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

notToHave

infix fun <E, T : Iterable<E>> Expect<T>.notToHave(elements: elements): Expect<T> (source)

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

expect(setOf<String>()) notToHave elements

fails {
    expect(listOf("A", "B")) notToHave elements
}

Return
an Expect for the subject of this expectation.

Since
0.17.0

infix fun <T : Iterator<*>> Expect<T>.notToHave(next: next): Expect<T> (source)

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

val list = listOf(1)
val iterator = list.iterator()

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

iterator.next()                      // returns the next element in iteration
expect(iterator) notToHave next      // list has no more elements thus expectation holds

Return
an Expect for the subject of this expectation.

Since
0.17.0