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

keyValues

fun <K, V : Any> keyValues(keyValue: KeyWithValueCreator<K, V>, vararg otherKeyValues: KeyWithValueCreator<K, V>): KeyValues<K, V> (source)

Helper function to create a KeyValues based on the given keyValue and otherKeyValues -- allows expressing Pair<K, (Expect<V>.() -> Unit)?>, vararg Pair<K, (Expect<V>.() -> Unit)?>.

expect(mapOf(1 to "a")) toContain keyValues(
    keyValue(1) { // subject inside this block is of type String (actually "a")
        this toEqual "a"
    }
)

fails {
    expect(mapOf(1 to "a")) toContain keyValues(
        keyValue(1) { // subject inside this block is of type String (actually "a")
            this toEqual "b"
        }
    )
}
fun <K, V : Any> keyValues(keyValue: KeyWithValueCreator<K, V>, vararg otherKeyValues: KeyWithValueCreator<K, V>, reportOptionsInOrderOnly: InOrderOnlyReportingOptions.() -> Unit): WithInOrderOnlyReportingOptions<KeyValues<K, V>> (source)

Helper function to create a KeyValues based on the given keyValue and otherKeyValues -- allows expressing Pair<K, (Expect<V>.() -> Unit)?>, vararg Pair<K, (Expect<V>.() -> Unit)?>.

Parameters

reportOptionsInOrderOnly - The lambda configuring the InOrderOnlyReportingOptions -- it is optional where the default InOrderOnlyReportingOptions apply if not specified. since 0.18.0