doc / ch.tutteli.atrium.api.fluent.en_GB / getExisting

getExisting

fun <K, V, T : Map<out K, V>> Expect<T>.getExisting(key: K): Expect<V> (source)

Expects that the subject of the assertion (a Map) contains the given key, creates an Expect for the corresponding value and returns the newly created assertion container, so that further fluent calls are assertions about it.

Exceptions

AssertionError - Might throw an AssertionError if the given key does not exist.

Return
The newly created Expect for the extracted feature.

fun <K, V, T : Map<out K, V>> Expect<T>.getExisting(key: K, assertionCreator: Expect<V>.() -> Unit): Expect<T> (source)

Expects that the subject of the assertion (a Map) contains the given key and that the corresponding value holds all assertions the given assertionCreator creates for it.

Exceptions

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

Return
An Expect for the current subject of the assertion.