doc / ch.tutteli.atrium.api.cc.de_CH / enthaelt

enthaelt

val <T : CharSequence> IAssertionPlant<T>.enthaelt: CharSequenceContainsBuilder<T, CharSequenceContainsNoOpSearchBehaviour>

Creates an CharSequenceContainsBuilder based on this IAssertionPlant which allows to define more sophisticated contains assertions.

Return
The newly created builder.

fun <T : CharSequence> IAssertionPlant<T>.enthaelt(expected: Any, vararg otherExpected: Any): IAssertionPlant<T>

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

It is a shortcut for enthaelt.zumindest(1).werte(expected, *otherExpected).

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 expected is defined as 'a' and one 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 enthaelt to create a more sophisticated contains assertion where you can use options such as zumindest, hoechstens and genau to control the number of occurrences you expect.

Meaning you might want to use: enthaelt.genau(2).wert('a') instead of: enthaelt('a', 'a')

Exceptions

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

Return
This plant to support a fluent API.

fun <E, T : Iterable<E>> IAssertionPlant<T>.enthaelt(expected: E, vararg otherExpected: E): IAssertionPlant<T>

Makes the assertion that IAssertionPlant.subject contains expected and the otherExpected (if defined).

It is a shortcut for enthaelt.inBeliebigerReihenfolge.zumindest(1).werte(expected, *otherExpected)

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 zumindest, hoechstens and genau to control the number of occurrences you expect.

Meaning you might want to use: enthaelt.inBeliebigerReihenfolge.genau(2).wert('a') instead of: enthaelt('a', 'a')

Exceptions

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

Return
This plant to support a fluent API.

fun <E : Any, T : Iterable<E>> IAssertionPlant<T>.enthaelt(assertionCreator: IAssertionPlant<E>.() -> Unit, vararg otherAssertionCreators: IAssertionPlant<E>.() -> Unit): IAssertionPlant<T>

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

It is a shortcut for enthaelt.inBeliebigerReihenfolge.zumindest(1).eintraege(assertionCreator, *otherAssertionCreators)

Exceptions

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

Return
This plant to support a fluent API.