assertk.assertions / key

key

fun <K, V> Assert<Map<K, V>>.key(key: K, f: (Assert<V>) -> Unit): Unit
Deprecated: Use key(key) instead.

Platform and version requirements: Common

Returns an assert that asserts on the value at the given key in the map.

assertThat(mapOf("key" to "value")).key("key") { it.isEqualTo("value") }
fun <K, V> Assert<Map<K, V>>.key(key: K): Assert<V>

Platform and version requirements: Common

Returns an assert that asserts on the value at the given key in the map.

assertThat(mapOf("key" to "value")).key("key").isEqualTo("value")