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

getExisting

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

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.

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

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

Parameters

key - Use the function key(...) { ... } to create a KeyWithCreator where the first parameter corresponds to the key and the second is the assertionCreator-lambda

Exceptions

AssertionError - Might throw an AssertionError the given key does not exist or if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.