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

containsExactly

infix fun <E, T : Iterable<E>> Expect<T>.containsExactly(expected: E): Expect<T>

Expects that the subject of the assertion (an Iterable) contains only the expected value.

It is a shortcut for contains o inGiven order and only value expected

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E, T : Iterable<E>> Expect<T>.containsExactly(values: Values<E>): Expect<T>

Expects that the subject of the assertion (an Iterable) contains only the expected values in the defined order.

It is a shortcut for contains o inGiven order and only the Values(...)

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

values - The values which are expected to be contained within the Iterable -- use the function values(t, ...) to create a Values.

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T : Iterable<E?>> Expect<T>.containsExactly(assertionCreatorOrNull: (Expect<E>.() -> Unit)?): Expect<T>

Expects that the subject of the assertion (an Iterable) contains only an entry holding the assertions created by assertionCreatorOrNull or only one entry which is null in case assertionCreatorOrNull is defined as null.

It is a shortcut for contains o inGiven order and only entry assertionCreatorOrNull

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

assertionCreatorOrNull - The identification lambda which creates the assertions which the entry we are looking for has to hold; or in other words, the function which defines whether an entry is the one we are looking for or not. In case it is defined as null, then an entry is identified if it is null as well.

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T : Iterable<E?>> Expect<T>.containsExactly(entries: Entries<E>): Expect<T>

Expects that the subject of the assertion (an Iterable) contains only an entry holding the assertions created by entries.assertionCreatorOrNull or null in case entries.assertionCreatorOrNull is defined as null and likewise an additional entry for each entries.otherAssertionCreatorsOrNulls (if given) whereas the entries have to appear in the defined order.

It is a shortcut for contains o inGiven order and only the Entries(...)

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

entries - The entries which are expected to be contained within the Iterable -- use the function entries(t, ...) to create an Entries.

Exceptions

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

Return
An Expect for the current subject of the assertion.