atrium-api-cc-en_UK / ch.tutteli.atrium.api.cc.en_UK / ch.tutteli.atrium.assertions.iterable.contains.builders.IterableContainsCheckerBuilder / objects

objects

fun <E, T : Iterable<E>> IterableContainsCheckerBuilder<E, T, IterableContainsInAnyOrderSearchBehaviour>.objects(expected: E, vararg otherExpected: E): AssertionPlant<T>

Finishes the specification of the sophisticated contains assertion where the expected object as well as the otherExpected objects shall be searched within the iterable.

Notice, that it does not search for unique matches. Meaning, if the iterable is setOf('a', 'b') and expected is defined as 'a' and one otherExpected 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).objects('a') instead of: contains.inAnyOrder.atLeast(1).objects('a', 'a')

Parameters

expected - The object which is expected to be contained within the Iterable. otherExpected - Additional objects which are expected to be contained within Iterable.

Exceptions

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

Return
The AssertionPlant for which the assertion was built to support a fluent API.