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

contains

infix fun <T : CharSequence> Assert<T>.contains(expected: 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 the toString representation of the given expected using a non disjoint search.

It is a shortcut for to contain atLeast 1 value expected

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.

Exceptions

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

IllegalArgumentException - in case expected is not a CharSequence, Number or Char.

Return
This plant to support a fluent API.

infix fun <T : CharSequence> Assert<T>.contains(values: Values<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 the given values representation using a non disjoint search.

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

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 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.

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

Return
This plant to support a fluent API.

infix fun <T : CharSequence> Assert<T>.contains(defaultTranslationOf: DefaultTranslationsOf): 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 DefaultTranslationsOf.expected's getDefault representation and the getDefault representations of the DefaultTranslationsOf.otherExpected (if given), 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 atLeast, atMost and exactly 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 <T : CharSequence> Assert<T>.contains(patterns: RegexPatterns): 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 a sequence which matches the given patterns using a non disjoint search.

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

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 'ab' and RegexPatterns.pattern is defined as 'a(b)?' and one of the RegexPatterns.otherPatterns is defined as 'a(b)?' as well, then both match, even though they match the same sequence in the input of the search. 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 exactly 2 the regex 'a(b)?' instead of: to contain atLeast 1 the RegexPatterns('a(b)?', 'a(b)?')

Parameters

patterns - The patterns which are expected to have a match against the input of the search.

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.

infix fun <E, T : Iterable<E>> Assert<T>.contains(expected: E): <ERROR CLASS> (source)
Deprecated: Use `contains NullableValue` 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 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> (source)
Deprecated: Use `contains NullableValues` from package en_GB or `contains Values` 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 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 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 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 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 <E, T : Iterable<E>> Assert<T>.contains(objects: Objects<E>): AssertionPlant<T> (source)
Deprecated: Will be removed with 1.0.0 because it is redundant in terms of `contains Values(expected, otherExpected)` without adding enough to be a legit alternative.

Makes the assertion that the Assert.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: 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 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, 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 Entries.assertionCreator and an additional entry for each Entries.otherAssertionCreators (if given) 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.