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.
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.
@JvmName("theValuesWithReportingOptions") infix fun <E, T> IterableLikeContains.EntryPointStep<E, T, InAnyOrderOnlySearchBehaviour>.the(values: WithInAnyOrderOnlyReportingOptions<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.
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.
Return
an Expect for the subject of this
expectation.
Since
0.18.0
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) }, { 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.
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.
@JvmName("theEntriesWithReportingOptions") infix fun <E : Any, T> IterableLikeContains.EntryPointStep<out E?, T, InAnyOrderOnlySearchBehaviour>.the(entries: WithInAnyOrderOnlyReportingOptions<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) }, { 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.
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.
Return
an Expect for the subject of this
expectation.
Since
0.18.0
@JvmName("theElementsOfsWithReportingOptions") inline infix fun <reified E, T> IterableLikeContains.EntryPointStep<E, T, InAnyOrderOnlySearchBehaviour>.the(elementsOf: WithInAnyOrderOnlyReportingOptions<IterableLike>): Expect<T>
(source)@JvmName("theElementsOfWithReportingOptions") inline infix fun <reified E, T> IterableLikeContains.EntryPointStep<E, T, InOrderOnlySearchBehaviour>.the(elementsOf: WithInOrderOnlyReportingOptions<IterableLike>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion 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.
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.
IllegalArgumentException
- 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).
Return
an Expect for the subject of this
expectation.
Since
0.18.0
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.
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.
@JvmName("theValuesWithReportingOptions") infix fun <E, T> IterableLikeContains.EntryPointStep<E, T, InOrderOnlySearchBehaviour>.the(values: WithInOrderOnlyReportingOptions<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.
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.
Return
an Expect for the subject of this
expectation.
Since
0.18.0
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
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.
@JvmName("theEntriesWithReportingOptions") infix fun <E : Any, T> IterableLikeContains.EntryPointStep<out E?, T, InOrderOnlySearchBehaviour>.the(entries: WithInOrderOnlyReportingOptions<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
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.
Return
an Expect for the subject of this
expectation.
Since
0.18.0
infix fun <K, V, T> MapLikeContains.EntryPointStep<K, V, T, InAnyOrderOnlySearchBehaviour>.the(pairs: 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 key-value pairs where it does not matter
in which order they appear.
pairs
- The key-value Pairs expected to be contained within this MapLike
-- use the function pairs(x to y, ...)
to create a Pairs.
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
.
keyValues
- The KeyWithValueCreators -- use the function
keyValues(keyValue(key1) { ... }, keyValue(key2) { ... }, ...)
to create a KeyValues.
Return
an Expect for the subject of this
expectation.
Since
0.15.0
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.
pairs
- The key-value Pairs expected to be contained within this MapLike
-- use the function pairs(x to y, ...)
to create a Pairs.
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.
keyValues
- The KeyWithValueCreators -- use the function
keyValues(keyValue(key1) { ... }, keyValue(key2) { ... }, ...)
to create a KeyValues.
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(pairs: 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 key-value pairs in the specified order.
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.
Return
an Expect for the subject of this
expectation.
Since
0.15.0
@JvmName("thePairsWithReportingOption") infix fun <K, V, T> MapLikeContains.EntryPointStep<K, V, T, InOrderOnlySearchBehaviour>.the(pairs: WithInOrderOnlyReportingOptions<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 pairs in the specified order.
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.
Return
an Expect for the subject of this
expectation.
Since
0.18.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
.
keyValues
- The KeyWithValueCreators -- use the function
keyValues(keyValue(key1) { ... }, keyValue(key2) { ... }, ...)
to create a KeyValues.
Return
an Expect for the subject of this
expectation.
Since
0.15.0
@JvmName("theKeyValuesWithReportingOption") inline infix fun <K, reified V : Any, T> MapLikeContains.EntryPointStep<K, out V?, T, InOrderOnlySearchBehaviour>.the(keyValues: WithInOrderOnlyReportingOptions<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
.
keyValues
- The KeyWithValueCreators plus a lambda configuring the InOrderOnlyReportingOptions
-- use the function keyValues(keyValue(key1) { ... }, keyValue(key2) { ... }, ..., reportOptionsInOrderOnly = { ... })
to create a WithInOrderOnlyReportingOptions with a wrapped KeyValues.
Return
an Expect for the subject of this
expectation.
Since
0.18.0
infix fun <K, V, T> MapLikeContains.EntryPointStep<K, V, T, InOrderOnlySearchBehaviour>.the(entriesOf: WithInOrderOnlyReportingOptions<MapLike>): Expect<T>
(source)
Finishes the specification of the sophisticated contains
assertion where the subject (a MapLike)
needs to contain only and all entries of the given MapLike in the specified order.
Delegates to keyValue.
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.
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.
IllegalArgumentException
- 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).
Return
an Expect for the subject of this
expectation.
Since
0.18.0