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

toContainKey

infix fun <K, T : Map<out K, *>> Expect<T>.toContainKey(key: K): Expect<T> (source)

Expects that the subject of this expectation (a Map) contains the given key.

expect(mapOf(1 to "a")) toContainKey 1

fails { // because the map does not contain a key that equals 2
    expect(mapOf(1 to "a")) toContainKey 2
}

Return
an Expect for the subject of this expectation.