doc / ch.tutteli.atrium.api.cc.en_GB / containsNullableValues

containsNullableValues

fun <E, T : Iterable<E>> Assert<T>.containsNullableValues(expectedOrNull: E, vararg otherExpectedOrNulls: E): AssertionPlant<T> (source)

Makes the assertion that AssertionPlant.subject (which has a nullable entry type) contains the expected nullable value and the other expected nullable values (if given).

It is a shortcut for contains.inAnyOrder.atLeast(1).nullableValues(expectedOrNull, *otherExpectedOrNulls)

Notice, that it does not search for unique matches. Meaning, if the iterable is setOf('a', 'b') and expectedOrNull is defined as 'a' and one otherExpectedOrNulls is defined as 'a' as well, then both match, even though they match the same entry. Use an option such as atLeast, atMost and exactly to control the number of occurrences you expect.

Meaning you might want to use: contains.inAnyOrder.exactly(2).nullableValue('a') instead of: contains('a', 'a')

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
This plant to support a fluent API.