doc / ch.tutteli.atrium.api.cc.infix.en_UK / contains

contains

infix fun <T : CharSequence> Assert<T>.contains(expected: Any): AssertionPlant<T>

Makes the assertion that AssertionPlant.subject contains the toString representation of the given expected using a non disjoint search.

It is a shortcut for to contain atLeast 1 value expected

By non disjoint is meant that 'aa' in 'aaaa' is found three times and not only two times.

Exceptions

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

Return
This plant to support a fluent API.

infix fun <T : CharSequence> Assert<T>.contains(values: Values<Any>): AssertionPlant<T>

Makes the assertion that AssertionPlant.subject contains the given values representation using a non disjoint search.

It is a shortcut for to contain atLeast 1 the Values(...)

By non disjoint is meant that 'aa' in 'aaaa' is found three times and not only two times. Also notice, that it does not search for unique matches. Meaning, if the input of the search is 'a' and Values.expected is defined as 'a' and one Values.otherExpected is defined as 'a' as well, then both match, even though they match the same sequence in the input of the search. Use the property contains to create a more sophisticated contains assertion where you can use options such as atLeast, atMost and exactly to control the number of occurrences you expect.

Meaning you might want to use: to contain exactly 2 the value 'a' instead of: contains Values('a', 'a')

Exceptions

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

Return
This plant to support a fluent API.

infix fun <T : CharSequence> Assert<T>.contains(defaultTranslationOf: DefaultTranslationsOf): AssertionPlant<T>

Makes the assertion that AssertionPlant.subject contains DefaultTranslationsOf.expected's getDefault representation and the getDefault representations of the DefaultTranslationsOf.otherExpected (if defined), using a non disjoint search.

It is a shortcut for to contain atLeast 1 the DefaultTranslationsOf(...)

By non disjoint is meant that 'aa' in 'aaaa' is found three times and not only two times. Also notice, that it does not search for unique matches. Meaning, if the input of the search is 'a' and the default translation of DefaultTranslationsOf.expected is defined as 'a' and one default translation of the DefaultTranslationsOf.otherExpected is defined as 'a' as well, then both match, even though they match the same sequence in the input of the search. Use an option such as zumindest, hoestens and genau to control the number of occurrences you expect.

Meaning you might want to use: to contain exactly 2 defaultTranslationOf IS instead of: to contain atLeast 1 the DefaultTranslationOf(IS, IS)

Exceptions

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

Return
This plant to support a fluent API.

infix fun <E, T : Iterable<E>> Assert<T>.contains(expected: E): AssertionPlant<T>

Makes the assertion that AssertionPlant.subject contains the expected value.

It is a shortcut for to contain inAny order atLeast 1 value expected

Exceptions

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

Return
This plant to support a fluent API.

infix fun <E, T : Iterable<E>> Assert<T>.contains(values: Values<E>): AssertionPlant<T>

Makes the assertion that AssertionPlant.subject contains the expected values.

It is a shortcut for to contain inAny order atLeast 1 the Values(...)

Notice, that it does not search for unique matches. Meaning, if the iterable is setOf('a', 'b') and Objects.expected is defined as 'a' and one Objects.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: to contain inAny order exactly 2 value('a') instead of: contains Objects('a', 'a')

Exceptions

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

Return
This plant to support a fluent API.

infix fun <E, T : Iterable<E>> Assert<T>.contains(objects: Objects<E>): AssertionPlant<T>

Makes the assertion that AssertionPlant.subject contains the expected objects.

It is a shortcut for to contain inAny order atLeast 1 the Objects(...)

Notice, that it does not search for unique matches. Meaning, if the iterable is setOf('a', 'b') and Objects.expected is defined as 'a' and one Objects.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: to contain inAny order exactly 2 value('a') instead of: contains Objects('a', 'a')

Exceptions

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

Return
This plant to support a fluent API.

infix fun <E : Any, T : Iterable<E>> Assert<T>.contains(assertionCreator: AssertionPlant<E>.() -> Unit): AssertionPlant<T>

Makes the assertion that AssertionPlant.subject contains an entry holding the assertions created by the assertionCreator where it does not matter in which order the entries appear.

It is a shortcut for to contain inAny order atLeast 1 entry { ... }

Exceptions

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

Return
This plant to support a fluent API.

infix fun <E : Any, T : Iterable<E>> Assert<T>.contains(entries: Entries<E>): AssertionPlant<T>

Makes the assertion that AssertionPlant.subject contains an entry holding the assertions created by the Entries.assertionCreator and an additional entry for each Entries.otherAssertionCreators (if defined) where it does not matter in which order the entries appear.

It is a shortcut for to contain inAny order atLeast 1 the Entries(...)

Exceptions

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

Return
This plant to support a fluent API.