doc / ch.tutteli.atrium.api.infix.en_GB / the

the

infix fun <T : CharSequence> CharSequenceContains.CheckerStep<T, NoOpSearchBehaviour>.the(values: Values<CharSequenceOrNumberOrChar>): Expect<T>
infix fun <T : CharSequence> CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>.the(values: Values<CharSequenceOrNumberOrChar>): Expect<T>

Finishes the specification of the sophisticated contains assertion 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: contains o exactly 2 the value "a" instead of: contains o atLeast 1 the values("a", "a")

Parameters

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

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
An Expect for the current subject of the assertion.

@JvmName("valuesIgnoringCase") infix fun <T : CharSequence> CharSequenceContains.CheckerStep<T, IgnoringCaseSearchBehaviour>.the(values: Values<CharSequenceOrNumberOrChar>): Expect<T>
@JvmName("valuesIgnoringCase") infix fun <T : CharSequence> CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>.the(values: Values<CharSequenceOrNumberOrChar>): Expect<T>

Finishes the specification of the sophisticated contains assertion 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: contains o ignoring case exactly 2 the value "a" instead of: contains o ignoring case atLeast 1 the values("a", "a")

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.

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
An Expect for the current subject of the assertion.

infix fun <T : CharSequence> CharSequenceContains.EntryPointStep<T, IgnoringCaseSearchBehaviour>.the(values: Values<CharSequenceOrNumberOrChar>): Expect<T>
infix fun <T : CharSequence> CharSequenceContains.Builder<T, IgnoringCaseSearchBehaviour>.the(values: Values<CharSequenceOrNumberOrChar>): Expect<T>

Finishes the specification of the sophisticated contains assertion 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: contains o ignoring case exactly 2 the value "a" instead of: contains o ignoring case atLeast 1 the values("a", "a")

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.

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
An Expect for the current subject of the assertion.

infix fun <T : CharSequence> CharSequenceContains.CheckerStep<T, NoOpSearchBehaviour>.the(patterns: RegexPatterns): Expect<T>
infix fun <T : CharSequence> CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>.the(patterns: RegexPatterns): Expect<T>

Finishes the specification of the sophisticated contains assertion 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: contains o exactly 2 regex "a(b)?" instead of: contains o 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 -- use the function regexPatterns(t, ...) to create a RegexPatterns.

Exceptions

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

Return
An Expect for the current subject of the assertion.

@JvmName("regexIgnoringCase") infix fun <T : CharSequence> CharSequenceContains.CheckerStep<T, IgnoringCaseSearchBehaviour>.the(patterns: RegexPatterns): Expect<T>
@JvmName("regexIgnoringCase") infix fun <T : CharSequence> CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>.the(patterns: RegexPatterns): Expect<T>

Finishes the specification of the sophisticated contains assertion 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: contains o ignoring case exactly 2 the regex "a(b)?" instead of: contains o ignoring case 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 -- use the function regexPatterns(t, ...) to create a RegexPatterns.

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <T : CharSequence> CharSequenceContains.EntryPointStep<T, IgnoringCaseSearchBehaviour>.the(patterns: RegexPatterns): Expect<T>
infix fun <T : CharSequence> CharSequenceContains.Builder<T, IgnoringCaseSearchBehaviour>.the(patterns: RegexPatterns): Expect<T>

Finishes the specification of the sophisticated contains assertion 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: contains o ignoring case exactly 2 the regex "a(b)?" instead of: contains o ignoring case 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 -- use the function regexPatterns(t, ...) to create a RegexPatterns.

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E, T : Iterable<E>> IterableContains.CheckerOption<E, T, InAnyOrderSearchBehaviour>.the(values: Values<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the expected values shall be searched within the Iterable.

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')

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T : Iterable<E?>> IterableContains.CheckerOption<E?, T, InAnyOrderSearchBehaviour>.the(entries: Entries<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where an entry shall be searched which either holds all assertions entries.assertionCreatorOrNull creates or needs to be null in case entries.assertionCreatorOrNull is defined as null -- likewise an entry (can be the same) is searched for each of the entries.otherAssertionCreatorsOrNulls.

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E, T : Iterable<E>> IterableContains.Builder<E, T, InAnyOrderOnlySearchBehaviour>.the(values: Values<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the expected values must be contained in Iterable but it does not matter in which order.

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T : Iterable<E?>> IterableContains.Builder<E?, T, InAnyOrderOnlySearchBehaviour>.the(entries: Entries<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where an entry needs to be contained in the Iterable which holds all assertions entries.assertionCreatorOrNull creates or it needs to be null in case entries.assertionCreatorOrNull is defined as null -- likewise an entry for each entries.otherAssertionCreatorsOrNulls needs to be contained in the Iterable where it does not matter in which order the entries appear but only as many entries should be returned by the Iterable as assertion creators are defined.

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) }, { toBe(1) }) but for entries({ toBe(1) }, { isGreaterThan(0) }) otherwise isGreaterThan(0) matches 1 before toBe(1) would match it. As a consequence toBe(1) could only match the entry which is left -- in this case 2 -- and of course this would fail.

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E, T : Iterable<E>> IterableContains.Builder<E, T, InOrderOnlySearchBehaviour>.the(values: Values<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the Iterable needs to contain only the expected values in the specified order.

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T : Iterable<E?>> IterableContains.Builder<E?, T, InOrderOnlySearchBehaviour>.the(entries: Entries<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the Iterable needs to contain only an entry which holds all assertions entries.assertionCreatorOrNull creates or is null in case entries.assertionCreatorOrNull is defined as null and likewise a further entry for each entries.otherAssertionCreatorsOrNulls (if given) whereas the entries have to appear in the specified order.

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E, T> IterableLikeContains.CheckerStep<E, T, InAnyOrderSearchBehaviour>.the(values: Values<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the expected values shall be searched within the IterableLike.

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')

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

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

infix fun <E : Any, T> IterableLikeContains.CheckerStep<out E?, T, InAnyOrderSearchBehaviour>.the(entries: Entries<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where an entry shall be searched which either holds all assertions entries.assertionCreatorOrNull creates or needs to be null in case entries.assertionCreatorOrNull is defined as null -- likewise an entry (can be the same) is searched for each of the entries.otherAssertionCreatorsOrNulls.

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

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

infix fun <E, T> IterableLikeContains.EntryPointStep<E, T, InAnyOrderOnlySearchBehaviour>.the(values: Values<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the expected values must be contained in IterableLike but it does not matter in which order.

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E : Any, T> IterableLikeContains.EntryPointStep<out E?, T, InAnyOrderOnlySearchBehaviour>.the(entries: Entries<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where an entry needs to be contained in the IterableLike which holds all assertions entries.assertionCreatorOrNull creates or it needs to be null in case entries.assertionCreatorOrNull is defined as null -- likewise an entry for each entries.otherAssertionCreatorsOrNulls needs to be contained in the IterableLike where it does not matter in which order the entries appear but only as many entries should be returned by the IterableLike as assertion creators are defined.

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) }, { toBe(1) }) but for entries({ toBe(1) }, { isGreaterThan(0) }) otherwise isGreaterThan(0) matches 1 before toBe(1) would match it. As a consequence toBe(1) could only match the entry which is left -- in this case 2 -- and of course this would fail.

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

infix fun <E, T> IterableLikeContains.EntryPointStep<E, T, InOrderOnlySearchBehaviour>.the(values: Values<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the IterableLike needs to contain only the expected values in the specified order.

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

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

infix fun <E : Any, T> IterableLikeContains.EntryPointStep<out E?, T, InOrderOnlySearchBehaviour>.the(entries: Entries<E>): Expect<T>

Finishes the specification of the sophisticated contains assertion where the IterableLike needs to contain only an entry which holds all assertions entries.assertionCreatorOrNull creates or is null in case entries.assertionCreatorOrNull is defined as null and likewise a further entry for each entries.otherAssertionCreatorsOrNulls (if given) whereas the entries have to appear in the specified order.

Note that we might change the signature of this function with the next version which will cause a binary backward compatibility break (see #292 for more information)

Parameters

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

Exceptions

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

Return
An Expect for the current subject of the assertion.

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