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

contains

val <T : CharSequence> Assert<T>.contains: CharSequenceContains.Builder<T, NoOpSearchBehaviour> (source)
Deprecated: Use pendant from package en_GB; will be removed with 1.0.0

Creates a CharSequenceContains.Builder based on this AssertionPlant which allows to define more sophisticated contains assertions.

Return
The newly created builder.

fun <T : CharSequence> Assert<T>.contains(expected: Any, vararg otherExpected: Any): AssertionPlant<T> (source)
Deprecated: Use pendant from package en_GB; will be removed with 1.0.0

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

It is a shortcut for contains.atLeast(1).values(expected, *otherExpected).

Notice that a runtime check applies which assures that only CharSequence, Number and Char are passed (this function expects Any for your convenience, so that you can mix String and Int for instance).

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 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: contains.exactly(2).value('a') instead of: contains('a', 'a')

Exceptions

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

IllegalArgumentException - in case expected or one of the otherExpected is not a CharSequence, Number or Char.

Return
This plant to support a fluent API.

fun <E, T : Iterable<E>> Assert<T>.contains(expected: E, vararg otherExpected: E): AssertionPlant<T> (source)
Deprecated: Use `containsNullableValues` from package en_GB or `contains` from package en_GB in case you do not deal with nullable elements; will be removed with 1.0.0

Makes the assertion that the Assert.subject contains expected and the otherExpected (if given).

It is a shortcut for contains.inAnyOrder.atLeast(1).values(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 atLeast, atMost and exactly to control the number of occurrences you expect.

Meaning you might want to use: contains.inAnyOrder.exactly(2).value('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.

fun <E : Any, T : Iterable<E>> Assert<T>.contains(assertionCreator: Assert<E>.() -> Unit, vararg otherAssertionCreators: Assert<E>.() -> Unit): AssertionPlant<T> (source)
Deprecated: Use pendant from package en_GB; will be removed with 1.0.0

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

It is a shortcut for contains.inAnyOrder.atLeast(1).entries(assertionCreator, *otherAssertionCreators)

Exceptions

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

Return
This plant to support a fluent API.