fun <T : CharSequence> CharSequenceContains.CheckerOption<T, NoOpSearchBehaviour>.values(expected: Any, vararg otherExpected: Any): AssertionPlant<T>
(source)Finishes the specification of the sophisticated contains
assertion where the expected value as well as
the otherExpected 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 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 expected
is defined as 'a'
and one 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:
contains.exactly(2).value('a')
instead of:
contains.atLeast(1).values('a', 'a')
expected
- The value which is expected to be contained within the input of the search.
otherExpected
- Additional values which are expected to be contained within the input of the search.
AssertionError
- Might throw an AssertionError if the assertion made is not correct.
IllegalArgumentException
- in case expected or one of the otherExpected is not a
CharSequence, Number or Char.
Return
The AssertionPlant for which the assertion was built to support a fluent API.
@JvmName("valuesIgnoringCase") fun <T : CharSequence> CharSequenceContains.CheckerOption<T, IgnoringCaseSearchBehaviour>.values(expected: Any, vararg otherExpected: Any): AssertionPlant<T>
(source)Finishes the specification of the sophisticated contains
assertion where the expected value as well as
the otherExpected 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 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 expected
is defined as 'a'
and one 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:
contains.ignoringCase.exactly(2).value('a')
instead of:
contains.ignoringCase.atLeast(1).values('a', 'a')
expected
- The value which is expected to be contained within the input of the search.
otherExpected
- Additional values which are expected to be contained within the input of the search.
AssertionError
- Might throw an AssertionError if the assertion made is not correct.
IllegalArgumentException
- in case expected or one of the otherExpected is not a
CharSequence, Number or Char.
Return
The AssertionPlant for which the assertion was built to support a fluent API.
fun <T : CharSequence> CharSequenceContains.Builder<T, IgnoringCaseSearchBehaviour>.values(expected: Any, vararg otherExpected: Any): AssertionPlant<T>
(source)Finishes the specification of the sophisticated contains
assertion where the expected value as well as
the otherExpected values shall be searched (ignoring case), using a non disjoint search
where each need to be contained at least once.
Delegates to atLeast(1).values(expected, otherExpected)
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 expected
is defined as 'a'
and one otherExpected is defined as 'a'
as well, then both match, even though they match the
same sequence in the input of the search.
expected
- The value which is expected to be contained within the input of the search.
otherExpected
- Additional values which are expected to be contained within the input of the search.
AssertionError
- Might throw an AssertionError if the assertion made is not correct.
IllegalArgumentException
- in case expected or one of the otherExpected is not a
CharSequence, Number or Char.
Return
The AssertionPlant for which the assertion was built to support a fluent API.
fun <E, T : Iterable<E>> IterableContains.CheckerOption<E, T, InAnyOrderSearchBehaviour>.values(expected: E, vararg otherExpected: E): AssertionPlant<T>
(source)Finishes the specification of the sophisticated contains
assertion where the expected
value as well as the otherExpected values (if given) shall be searched within the Iterable.
Notice, that it does not search for unique matches. Meaning, if the iterable is setOf('a', 'b')
and
expected is defined as 'a'
and one 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:
contains.inAnyOrder.exactly(2).values('a')
instead of:
contains.inAnyOrder.atLeast(1).values('a', 'a')
expected
- The object which is expected to be contained within the Iterable.
otherExpected
- Additional objects which are expected to be contained within Iterable.
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.
fun <E, T : Iterable<E>> IterableContains.Builder<E, T, InAnyOrderOnlySearchBehaviour>.values(expected: E, vararg otherExpected: E): AssertionPlant<T>
(source)Finishes the specification of the sophisticated contains
assertion where the expected
value as well as the otherExpected values (if given) need to be
contained in Iterable where it does not matter in which order but only as
many entries should be returned by the Iterable as values defined.
expected
- The value which is expected to be contained within the Iterable.
otherExpected
- Additional values which are expected to be contained within Iterable.
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.
fun <E, T : Iterable<E>> IterableContains.Builder<E, T, InOrderOnlySearchBehaviour>.values(expected: E, vararg otherExpected: E): AssertionPlant<T>
(source)Finishes the specification of the sophisticated contains
assertion where the Iterable needs to contain only the
expected value as well as the otherExpected values
(if given) in the specified order.
expected
- The value which is expected to be contained within the Iterable.
otherExpected
- Additional values which are expected to be contained within Iterable.
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.
fun <K, V, T : Map<K, V>> Assert<T>.values(assertionCreator: Assert<Collection<V>>.() -> Unit): AssertionPlant<T>
(source)Makes the assertion that the Assert.subject's property values holds all assertions the given assertionCreator might create for it.
AssertionError
- Might throw an AssertionError if a created Assertions (by calling assertionCreator)
does not hold.
IllegalArgumentException
- in case the given assertionCreator did not create a single assertion.
Return
This plant to support a fluent API.
val <V> Assert<Map<*, V>>.values: Assert<Collection<V>>
(source)Creates an AssertionPlant for the Assert.subject's property values so that further fluent calls are assertions about it.
Wrap it into Kotlin's apply if you want to make subsequent assertions on the current subject or use the overload which expects an assertionCreator lambda where sub assertions are evaluated together (form an assertion group block).
Return
The newly created AssertionPlant.