infix fun <T : CharSequence> CharSequenceContains.CheckerStep<T, NoOpSearchBehaviour>.the(values: Values<CharSequenceOrNumberOrChar>): Expect<T>
(source)
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")
values
- The values which should not be found within the input of the search
-- use the function values(t, ...)
to create a Values.
IllegalArgumentException
- in case one of the values is not a CharSequence, Number or Char.
Return
an Expect for the subject of this
expectation.
@JvmName("valuesIgnoringCase") infix fun <T : CharSequence> CharSequenceContains.CheckerStep<T, IgnoringCaseSearchBehaviour>.the(values: Values<CharSequenceOrNumberOrChar>): Expect<T>
(source)
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")
values
- The values which are expected to be contained within the input of the search
-- use the function values(t, ...)
to create a Values.
IllegalArgumentException
- in case one of the values is not a CharSequence, Number or Char.
Return
an Expect for the subject of this
expectation.
infix fun <T : CharSequence> CharSequenceContains.EntryPointStep<T, IgnoringCaseSearchBehaviour>.the(values: Values<CharSequenceOrNumberOrChar>): Expect<T>
(source)
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")
values
- The values which are expected to be contained within the input of the search
-- use the function values(t, ...)
to create a Values.
IllegalArgumentException
- in case one of the values is not a CharSequence, Number or Char.
Return
an Expect for the subject of this
expectation.
infix fun <T : CharSequence> CharSequenceContains.CheckerStep<T, NoOpSearchBehaviour>.the(patterns: RegexPatterns): Expect<T>
(source)
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)?")
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.
Return
an Expect for the subject of this
expectation.
@JvmName("regexIgnoringCase") infix fun <T : CharSequence> CharSequenceContains.CheckerStep<T, IgnoringCaseSearchBehaviour>.the(patterns: RegexPatterns): Expect<T>
(source)
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)?")
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.
Return
an Expect for the subject of this
expectation.
infix fun <T : CharSequence> CharSequenceContains.EntryPointStep<T, IgnoringCaseSearchBehaviour>.the(patterns: RegexPatterns): Expect<T>
(source)
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)?")
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.
Return
an Expect for the subject of this
expectation.
infix fun <E, T> IterableLikeContains.CheckerStep<E, T, InAnyOrderSearchBehaviour>.the(values: Values<E>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion 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')
values
- The values which are expected to be contained within the IterableLike
-- use the function values(t, ...)
to create a Values.
Return
an Expect for the subject of this
expectation.
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>
(source)
Finishes the specification of the sophisticated contains
assertion 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
.
entries
- The entries which are expected to be contained within the IterableLike
-- use the function entries(t, ...)
to create an Entries.
Return
an Expect for the subject of this
expectation.
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>
(source)
Finishes the specification of the sophisticated contains
assertion where the subject (an IterableLike)
needs to contain only the expected values where 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)
values
- The values which are expected to be contained within the IterableLike
-- use the function values(t, ...)
to create a Values.
Return
an Expect for the subject of this
expectation.
infix fun <E : Any, T> IterableLikeContains.EntryPointStep<out E?, T, InAnyOrderOnlySearchBehaviour>.the(entries: Entries<E>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion 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) }, { 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)
entries
- The entries which are expected to be contained within the IterableLike
-- use the function entries(t, ...)
to create an Entries.
Return
an Expect for the subject of this
expectation.
infix fun <E, T> IterableLikeContains.EntryPointStep<E, T, InOrderOnlySearchBehaviour>.the(values: Values<E>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion where the subject (an 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)
values
- The values which are expected to be contained within the IterableLike
-- use the function values(t, ...)
to create a Values.
Return
an Expect for the subject of this
expectation.
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>
(source)
Finishes the specification of the sophisticated contains
assertion 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
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)
entries
- The entries which are expected to be contained within the IterableLike
-- use the function entries(t, ...)
to create an Entries.
Return
an Expect for the subject of this
expectation.
Since
0.14.0 -- API existed for Iterable but not for IterableLike.
infix fun <K, V, T> MapLikeContains.EntryPointStep<K, V, T, InAnyOrderSearchBehaviour>.the(pairs: Pairs<K, V>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion 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
inline infix fun <K, reified V : Any, T> MapLikeContains.EntryPointStep<K, out V?, T, InAnyOrderSearchBehaviour>.the(keyValues: KeyValues<K, V>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion 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
infix fun <K, V, T> MapLikeContains.EntryPointStep<K, V, T, InAnyOrderOnlySearchBehaviour>.the(keyValuePairs: Pairs<K, V>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion where the subject (a MapLike)
needs to contain only the given keyValuePairs where it does not matter
in which order they appear.
Return
an Expect for the subject of this
expectation.
Since
0.15.0
inline infix fun <K, reified V : Any, T> MapLikeContains.EntryPointStep<K, out V?, T, InAnyOrderOnlySearchBehaviour>.the(keyValues: KeyValues<K, V>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion where the subject (a MapLike)
needs to contain only 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
.
Return
an Expect for the subject of this
expectation.
Since
0.15.0
infix fun <K, V, T> MapLikeContains.EntryPointStep<K, V, T, InOrderOnlySearchBehaviour>.the(keyValuePairs: Pairs<K, V>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion where the subject (a MapLike)
needs to contain only the given keyValuePairs in the specified order.
Return
an Expect for the subject of this
expectation.
Since
0.15.0
inline infix fun <K, reified V : Any, T> MapLikeContains.EntryPointStep<K, out V?, T, InOrderOnlySearchBehaviour>.the(keyValues: KeyValues<K, V>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion where the subject (a MapLike)
needs to contain only the given keyValues 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