doc / ch.tutteli.atrium.api.cc.en_GB / key

key

val <K : Any> Assert<Entry<K, *>>.key: Assert<K>
Deprecated: Switch from Assert to Expect; will be removed with 1.0.0

Creates an AssertionPlant for the Assert.subject's property key so that further fluent calls are assertions about it.

Wrap it into Kotlin's apply if you want to make subsequent assertions on the current subject or use the overload which expects an assertionCreator lambda where sub assertions are evaluated together (form an assertion group block).

Return
The newly created AssertionPlant.

fun <K : Any, V> Assert<Entry<K, V>>.key(assertionCreator: Assert<K>.() -> Unit): AssertionPlant<Entry<K, V>>
Deprecated: Switch from Assert to Expect; will be removed with 1.0.0

Makes the assertion that the Assert.subject's property key holds all assertions the given assertionCreator might create for it.

Exceptions

AssertionError - Might throw an AssertionError if a created Assertions (by calling assertionCreator) does not hold.

IllegalArgumentException - in case the given assertionCreator did not create a single assertion.

Return
This plant to support a fluent API.