atrium-api-fluent-en_GB-jvm / ch.tutteli.atrium.api.fluent.en_GB / values

values

fun <T : CharSequence> <ERROR CLASS><T, <ERROR CLASS>>.values(expected: Any, vararg otherExpected: Any): <ERROR CLASS><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")

Parameters

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.

Exceptions

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

fun <E, T : Iterable<E>> <ERROR CLASS><E, T, <ERROR CLASS>>.values(expected: E, vararg otherExpected: E): <ERROR CLASS><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')

Parameters

expected - The object which is expected to be contained within this Iterable.

otherExpected - Additional objects which are expected to be contained within this Iterable.

Exceptions

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

Return
An Expect for the current subject of the assertion.

fun <K, V, T : Map<K, V>> <ERROR CLASS><T>.values(assertionCreator: <ERROR CLASS><Collection<V>>.() -> Unit): <ERROR CLASS><T> (source)

Expects that the property Map.keys of the subject of the assertion holds all assertions the given assertionCreator creates for it and returns an Expect for the current subject of the assertion.

Exceptions

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

Return
An Expect for the current subject of the assertion.

val <V, T : Map<*, V>> <ERROR CLASS><T>.values: <ERROR CLASS><Collection<V>> (source)

Creates an Expect for the property Map.values of the subject of the assertion, so that further fluent calls are assertions about it.

Return
The newly created Expect for the extracted feature.