the

Finishes the specification of the sophisticated to contain expectation where the given values shall be searched, using a non-disjoint search.

Notice that a runtime check applies which assures that only CharSequence, Number and Char are passed. This function expects CharSequenceOrNumberOrChar (which is a typealias for 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 is defined as values("a", "a"), 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: toContain o exactly 2 the value "a" instead of: toContain o atLeast 1 the values("a", "a")

Return

an Expect for the subject of this expectation.

Parameters

values

The values which should not be found within the input of the search -- use the function values(t, ...) to create a Values.

Throws

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


Finishes the specification of the sophisticated to contain expectation where the values shall be searched (ignoring case), using a non-disjoint search.

Notice that a runtime check applies which assures that only CharSequence, Number and Char are passed. This function expects CharSequenceOrNumberOrChar (which is a typealias for 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 is defined as values("a", "a"), 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: toContain o ignoring case exactly 2 the value "a" instead of: toContain o ignoring case atLeast 1 the values("a", "a")

Return

an Expect for the subject of this expectation.

Parameters

values

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

Throws

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


Finishes the specification of the sophisticated to contain expectation where the values shall be searched (ignoring case), using a non-disjoint search where each need to be contained at least once.

Delegates to atLeast 1 the value.

Notice that a runtime check applies which assures that only CharSequence, Number and Char are passed. This function expects CharSequenceOrNumberOrChar (which is a typealias for 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 is defined as values("a", "a"), 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: toContain o ignoring case exactly 2 the value "a" instead of: toContain o ignoring case atLeast 1 the values("a", "a")

Return

an Expect for the subject of this expectation.

Parameters

values

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

Throws

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


Finishes the specification of the sophisticated to contain expectation where the given regular expression patterns are expected to have a match, using a non-disjoint search.

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 is defined as regexPatterns("a(b)?", "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: toContain o exactly 2 regex "a(b)?" instead of: toContain o atLeast 1 the regexPatterns("a(b)?", "a(b)?")

Return

an Expect for the subject of this expectation.

Parameters

patterns

The patterns which are expected to have a match against the input of the search -- use the function regexPatterns(t, ...) to create a RegexPatterns.


Finishes the specification of the sophisticated to contain expectation where the given regular expression patterns are expected to have a match (ignoring case), using a non-disjoint search.

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 is defined as regexPatterns("a(b)?", "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: toContain o ignoring case exactly 2 regex "a(b)?" instead of: toContain o ignoring case atLeast 1 the regexPatterns("a(b)?", "a(b)?")

Return

an Expect for the subject of this expectation.

Parameters

patterns

The patterns which are expected to have a match against the input of the search -- use the function regexPatterns(t, ...) to create a RegexPatterns.


Finishes the specification of the sophisticated to contain expectation where the given regular expression patterns are expected to have at least one match (ignoring case), using a non-disjoint search.

Delegates to atLeast 1 the patterns.

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 is defined as regexPatterns("a(b)?", "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: toContain o ignoring case exactly 2 the regex "a(b)?" instead of: toContain o ignoring case atLeast 1 the RegexPatterns("a(b)?", "a(b)?")

Return

an Expect for the subject of this expectation.

Parameters

patterns

The patterns which are expected to have a match against the input of the search -- use the function regexPatterns(t, ...) to create a RegexPatterns.


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain the expected values where it does not matter in which order they appear.

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

Return

an Expect for the subject of this expectation.

Since

0.14.0 -- API existed for Iterable but not for IterableLike.

Parameters

values

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


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain an entry for each in entries where it does not matter in which order they appear -- an entry is contained if it either holds all assertions entries.assertionCreatorOrNull creates or needs to be null in case entries.assertionCreatorOrNull is defined as null.

Return

an Expect for the subject of this expectation.

Since

0.14.0 -- API existed for Iterable but not for IterableLike.

Parameters

entries

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


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only the expected values where it does not matter in which order.

Return

an Expect for the subject of this expectation.

Parameters

values

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


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only the expected values where it does not matter in which order.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

values

The values which are expected to be contained within the IterableLike plus a lambda configuring the InAnyOrderOnlyReportingOptions -- use the function values(t, ..., reportOptionsInAnyOrderOnly = { ... }) to create a WithInAnyOrderOnlyReportingOptions with a wrapped Values.


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only the given entries where it does not matter in which order they appear -- an entry is contained if it either holds all assertions entries.assertionCreatorOrNull creates or it needs to be null in case entries.assertionCreatorOrNull is defined as null

Notice, that a first-wins strategy applies which means your assertion creator lambdas -- which kind of serve as identification lambdas -- should be ordered in such a way that the most specific identification lambda appears first, not that a less specific lambda wins. For instance, given a setOf(1, 2) you should not search for entries({ isGreaterThan(0) }, { toEqual(1) }) but for entries({ toEqual(1) }, { isGreaterThan(0) }) otherwise isGreaterThan(0) matches 1 before toEqual(1) would match it. As a consequence toEqual(1) could only match the entry which is left -- in this case 2 -- and of course this would fail.

Return

an Expect for the subject of this expectation.

Parameters

entries

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


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only the given entries where it does not matter in which order they appear -- an entry is contained if it either holds all assertions entries.assertionCreatorOrNull creates or it needs to be null in case entries.assertionCreatorOrNull is defined as null

Notice, that a first-wins strategy applies which means your assertion creator lambdas -- which kind of serve as identification lambdas -- should be ordered in such a way that the most specific identification lambda appears first, not that a less specific lambda wins. For instance, given a setOf(1, 2) you should not search for entries({ isGreaterThan(0) }, { toEqual(1) }) but for entries({ toEqual(1) }, { isGreaterThan(0) }) otherwise isGreaterThan(0) matches 1 before toEqual(1) would match it. As a consequence toEqual(1) could only match the entry which is left -- in this case 2 -- and of course this would fail.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

entries

The entries which are expected to be contained within the IterableLike plus a lambda configuring the InAnyOrderOnlyReportingOptions -- use the function entries(t, ..., reportOptionsInAnyOrderOnly = { ... }) to create a WithInAnyOrderOnlyReportingOptions with a wrapped Entries.


@JvmName(name = "theElementsOfsWithReportingOptions")
infix inline fun <E, T : IterableLike> IterableLikeContains.EntryPointStep<E, T, InAnyOrderOnlySearchBehaviour>.the(elementsOf: WithInAnyOrderOnlyReportingOptions<IterableLike>): Expect<T>(source)

Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only and all elements of the given IterableLike in the specified order.

Delegates to values.

Notice that a runtime check applies which assures that only Iterable, Sequence or one of the Array types are passed (this can be changed via IterableLikeToIterableTransformer). This function expects IterableLike (which is a typealias for Any) to avoid cluttering the API.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

elementsOf

The IterableLike whose elements are expected to be contained within this IterableLike plus a lambda configuring the InOrderOnlyReportingOptions -- use the function elementsOf(iterableLike, report = { ... }) to create a WithInOrderOnlyReportingOptions with a wrapped IterableLike.

Throws

in case the wrapped IterableLike is not an Iterable, Sequence or one of the Array types or the wrapped IterableLike does not have elements (is empty).


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only the expected values in the specified order.

Return

an Expect for the subject of this expectation.

Since

0.14.0 -- API existed for Iterable but not for IterableLike.

Parameters

values

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


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only the expected values in the specified order.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

values

The values which are expected to be contained within the IterableLike plus a lambda configuring the InOrderOnlyReportingOptions -- use the function values(t, ..., reportOptionsInOrderOnly = { ... }) to create a WithInOrderOnlyReportingOptions with a wrapped Values.


Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only the given entries in the specified order -- an entry is contained if it either holds all assertions entries.assertionCreatorOrNull creates or it needs to be null in case entries.assertionCreatorOrNull is defined as null

Return

an Expect for the subject of this expectation.

Since

0.14.0 -- API existed for Iterable but not for IterableLike.

Parameters

entries

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


@JvmName(name = "theEntriesWithReportingOptions")
infix fun <E : Any, T : IterableLike> IterableLikeContains.EntryPointStep<out E?, T, InOrderOnlySearchBehaviour>.the(entries: WithInOrderOnlyReportingOptions<Entries<E>>): Expect<T>(source)

Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only the given entries in the specified order -- an entry is contained if it either holds all assertions entries.assertionCreatorOrNull creates or it needs to be null in case entries.assertionCreatorOrNull is defined as null

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

entries

The entries which are expected to be contained within the IterableLike plus a lambda configuring the InOrderOnlyReportingOptions -- use the function entries(t, ..., reportOptionsInOrderOnly = { ... }) to create a WithInOrderOnlyReportingOptions with a wrapped Entries.


@JvmName(name = "theElementsOfWithReportingOptions")
infix inline fun <E, T : IterableLike> IterableLikeContains.EntryPointStep<E, T, InOrderOnlySearchBehaviour>.the(elementsOf: WithInOrderOnlyReportingOptions<IterableLike>): Expect<T>(source)

Finishes the specification of the sophisticated to contain expectation where the subject (an IterableLike) needs to contain only and all elements of the given IterableLike in the specified order.

Delegates to values.

Notice that a runtime check applies which assures that only Iterable, Sequence or one of the Array types are passed (this can be changed via IterableLikeToIterableTransformer). This function expects IterableLike (which is a typealias for Any) to avoid cluttering the API.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

elementsOf

The IterableLike whose elements are expected to be contained within this IterableLike plus a lambda configuring the InOrderOnlyReportingOptions -- use the function elementsOf(iterableLike, report = { ... }) to create a WithInOrderOnlyReportingOptions with a wrapped IterableLike.

Throws

in case the wrapped IterableLike is not an Iterable, Sequence or one of the Array types or the wrapped IterableLike does not have elements (is empty).


Finishes the specification of the sophisticated to contain expectation where the subject (a MapLike) needs to contain the given key-value pairs where it does not matter in which order they appear.

Notice, that it does not search for unique matches. Meaning, if the map is mapOf('a' to 1) and one of the Pair in pairs is defined as 'a' to 1 and another one is defined as 'a' to 1 as well, then both match, even though they match the same entry.

Return

an Expect for the subject of this expectation.

Since

0.15.0

Parameters

pairs

The key-value Pairs expected to be contained within this MapLike -- use the function pairs(x to y, ...) to create a Pairs.

Samples

expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order the pairs(
    2 to "b"
)

fails { // because the value ("b") of key 1 (which exists in the subject) is not "b"
    expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order the pairs(1 to "b")
}

infix inline fun <K, V : Any, T : MapLike> MapLikeContains.EntryPointStep<K, out V?, T, InAnyOrderSearchBehaviour>.the(keyValues: KeyValues<K, V>): Expect<T>(source)

Finishes the specification of the sophisticated to contain expectation where the subject (a MapLike) needs to contain the given keyValues where it does not matter in which order they appear -- an entry is contained if it has a key as defined by keyValue's KeyWithValueCreator.key and a corresponding value which either holds all assertions keyValue's KeyWithValueCreator.valueAssertionCreatorOrNull creates or needs to be null in case KeyWithValueCreator.valueAssertionCreatorOrNull is defined as null.

Notice, that it does not search for unique matches. Meaning, if the map is mapOf('a' to 1) and one KeyWithValueCreator in keyValues is defined as Key('a') { isGreaterThan(0) } and another one is defined as Key('a') { isLessThan(2) } , then both match, even though they match the same entry.

Return

an Expect for the subject of this expectation

Since

0.15.0

Parameters

keyValues

The KeyWithValueCreators -- use the function keyValues(keyValue(key1) { ... }, keyValue(key2) { ... }, ...) to create a KeyValues.

Samples

expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order the entries(keyValue(2) { this toEqual "b" })

fails { // because the value ("b") of key 1 (which exists in the subject) is not "b"
    expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order the entries(keyValue(1) { this toEqual "b" })
}

Finishes the specification of the sophisticated to contain expectation where the subject (a MapLike) needs to contain only the given key-value pairs where it does not matter in which order they appear.

Return

an Expect for the subject of this expectation.

Since

0.15.0

Parameters

pairs

The key-value Pairs expected to be contained within this MapLike -- use the function pairs(x to y, ...) to create a Pairs.

Samples

expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order but only the pairs(
    2 to "b", 1 to "a"
)

fails { // because subject has additional entries
    expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order but only the pairs(1 to "a")
}

Finishes the specification of the sophisticated to contain expectation where the subject (a MapLike) needs to contain only the given entries where it does not matter in which order they appear -- an entry is contained if it has a key as defined by keyValue's KeyWithValueCreator.key and a corresponding value which either holds all assertions keyValue's KeyWithValueCreator.valueAssertionCreatorOrNull creates or needs to be null in case KeyWithValueCreator.valueAssertionCreatorOrNull is defined as null.

Return

an Expect for the subject of this expectation.

Since

0.15.0

Parameters

entries

The KeyWithValueCreators -- use the function keyValues(keyValue(key1) { ... }, keyValue(key2) { ... }, ...) to create a KeyValues.

Samples

expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order but only the entries(
    keyValue(2) { this toEqual "b" },
    keyValue(1) { this toEqual "a" },
)

fails { // because subject has additional entries
    expect(mapOf(1 to "a", 2 to "b")) toContain o inAny order but only the entries(
        keyValue(1) { this toEqual "a" }
    )
}

Finishes the specification of the sophisticated to contain expectation where the subject (a MapLike) needs to contain only the given key-value pairs in the specified order.

Return

an Expect for the subject of this expectation.

Since

0.15.0

Parameters

pairs

The key-value pairs which are expected to be contained within the MapLike -- use the function pairs(x to y, ...) to create a Pairs.

Samples

expect(mapOf(1 to "a", 2 to "b")) toContain o inGiven order and only the pairs(
    1 to "a", 2 to "b"
)

fails { // because the pair entries (which all exist in the subject) do not have the same order
    expect(mapOf(1 to "a", 2 to "b")) toContain o inGiven order and only the pairs(
        2 to "b",
        1 to "a",
    )
}

@JvmName(name = "thePairsWithReportingOption")
infix fun <K, V, T : MapLike> MapLikeContains.EntryPointStep<K, V, T, InOrderOnlySearchBehaviour>.the(pairs: WithInOrderOnlyReportingOptions<Pairs<K, V>>): Expect<T>(source)

Finishes the specification of the sophisticated to contain expectation where the subject (a MapLike) needs to contain only the given pairs in the specified order.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

pairs

The key-value pairs which are expected to be contained within the MapLike plus a lambda configuring the InOrderOnlyReportingOptions -- use the function pairs(t, ..., reportOptionsInOrderOnly = { ... }) to create a WithInOrderOnlyReportingOptions with a wrapped Pairs.


Finishes the specification of the sophisticated to contain expectation where the subject (a MapLike) needs to contain only the given entries in the specified order -- an entry is contained if it has a key as defined by keyValue's KeyWithValueCreator.key and a corresponding value which either holds all assertions keyValue's KeyWithValueCreator.valueAssertionCreatorOrNull creates or needs to be null in case KeyWithValueCreator.valueAssertionCreatorOrNull is defined as null.

Return

an Expect for the subject of this expectation.

Since

0.15.0

Parameters

entries

The KeyWithValueCreators -- use the function entries(keyValue(key1) { ... }, keyValue(key2) { ... }, ...) to create a KeyValues.

Samples

expect(mapOf(1 to "a", 2 to "b")) toContain o inGiven order and only the entries(
    keyValue(1) { this toEqual "a" },
    keyValue(2) { this toEqual "b" },
)

fails { // because the pair entries (which all exist in the subject) do not have the same order
    expect(mapOf(1 to "a", 2 to "b")) toContain o inGiven order and only the entries(
        keyValue(2) { this toEqual "b" },
        keyValue(1) { this toEqual "a" },
    )
}

@JvmName(name = "theKeyValuesWithReportingOption")
infix inline fun <K, V : Any, T : MapLike> MapLikeContains.EntryPointStep<K, out V?, T, InOrderOnlySearchBehaviour>.the(entries: WithInOrderOnlyReportingOptions<KeyValues<K, V>>): Expect<T>(source)

Finishes the specification of the sophisticated to contain expectation where the subject (a MapLike) needs to contain only the given entries in the specified order -- an entry is contained if it has a key as defined by keyValue's KeyWithValueCreator.key and a corresponding value which either holds all assertions keyValue's KeyWithValueCreator.valueAssertionCreatorOrNull creates or needs to be null in case KeyWithValueCreator.valueAssertionCreatorOrNull is defined as null.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

entries

The KeyWithValueCreators plus a lambda configuring the InOrderOnlyReportingOptions -- use the function entries(keyValue(key1) { ... }, keyValue(key2) { ... }, ..., reportOptionsInOrderOnly = { ... }) to create a WithInOrderOnlyReportingOptions with a wrapped KeyValues.


Finishes the specification of the sophisticated to contain expectation where the subject (a MapLike) needs to contain only and all entries of the given MapLike in the specified order.

Delegates to the pairs

Notice that a runtime check applies which assures that only Map and IterableLike (i.e. Iterable, Sequence or one of the Array types) are passed (this can be changed via MapLikeToIterablePairTransformer and IterableLikeToIterableTransformer). This function expects MapLike (which is a typealias for Any) to avoid cluttering the API.

Return

an Expect for the subject of this expectation.

Since

0.18.0

Parameters

entriesOf

The MapLike whose elements are expected to be contained within this MapLike plus a lambda configuring the InOrderOnlyReportingOptions -- use the function entriesOf(mapLike, report = { ... }) to create a WithInOrderOnlyReportingOptions with a wrapped MapLike.

Throws

in case the given MapLike is an unsupported type, or in other words, if the transformation from the given MapLike to Iterable<Pair<K, V>> fails, or it does not have elements (is empty).