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

values

fun <T> values(value: T, vararg otherValues: T): Values<T> (source)

Helper function to create a Values based on the given value and otherValues -- allows expressing T, vararg T.

fun <T> values(value: T, vararg otherValues: T, reportOptionsInOrderOnly: InOrderOnlyReportingOptions.() -> Unit): WithInOrderOnlyReportingOptions<Values<T>> (source)

Helper function to create a WithInOrderOnlyReportingOptions wrapping a Values based on the given value and otherValues as well as the given reportOptionsInOrderOnly-configuration-lambda -- allows expressing T, vararg T, reportOptionsInOrderOnly = { ... }.

Parameters

value - The first expected value.

otherValues - The other expected values in the given order.

reportOptionsInOrderOnly - The lambda configuring the InOrderOnlyReportingOptions.

Since
0.18.0

fun <T> values(value: T, vararg otherValues: T, reportOptionsInAnyOrderOnly: InAnyOrderOnlyReportingOptions.() -> Unit): WithInAnyOrderOnlyReportingOptions<Values<T>> (source)

Helper function to create a WithInOrderOnlyReportingOptions wrapping a Values based on the given value and otherValues as well as the given reportOptionsInAnyOrderOnly-configuration-lambda -- allows expressing T, vararg T, reportOptionsInAnyOrderOnly = { ... }.

Parameters

value - The first expected value.

otherValues - The other expected values in the given order.

reportOptionsInAnyOrderOnly - The lambda configuring the InOrderOnlyReportingOptions.

Since
0.18.0

infix fun <K, V, T : Map<out K, V>> Expect<T>.values(assertionCreator: Expect<Collection<V>>.() -> Unit): Expect<T> (source)

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

expect(mapOf(1 to "a")) values {   // subject inside this block is of type Collection<String> (containing "a")
    this toEqual setOf("a")
}

fails {
    // all expectations are evaluated inside an expectation group block; for more details:
    // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups

    expect(mapOf(1 to "a")) values { // subject inside this block is of type Collection<String> (containing <"a">)
        this toEqual setOf("b")      // fails because "a" is not equal to "b"
        // use `.values.` if you want a fail fast behaviour
    }
}

Return
an Expect for the subject of this expectation.

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

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

expect(mapOf(1 to "a")).values toContain "a"
//                     | subject is now of type Collection<String> (containing "a")

fails {
    // fails because "a" is not equal to "b"
    expect(mapOf(1 to "a")).values toContain "b"
    //                     | subject is now of type Collection<String> (containing "a")
}

Return
The newly created Expect for the extracted feature.