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

containsOnly

infix fun <K, V, T : Map<out K, V>> Expect<T>.containsOnly(keyValuePair: Pair<K, V>): Expect<T>

Expects that the subject of the assertion (a Map) contains only one entry with a key as defined by keyValuePair's Pair.first and a corresponding value as defined by keyValuePair's Pair.second

Delegates to 'it contains o inAny order but only entry keyValuePair'.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

infix fun <K, V, T : Map<out K, V>> Expect<T>.containsOnly(keyValuePairs: Pairs<K, V>): Expect<T>

Expects the subject of the assertion (a Map) contains only (in any order) for each entry in keyValuePairs, a key as defined by that entry's Pair.first with a corresponding value as defined by entry's Pair.second.

Delegates to it contains o inAny order but only the keyValuePairs

Parameters

keyValuePairs - The key-value Pairs expected to be contained within this Map -- use the function pairs(x to y, ...) to create a Pairs.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

inline infix fun <K, reified V : Any, T : Map<out K, V?>> Expect<T>.containsOnly(keyValue: KeyWithValueCreator<K, V>): Expect<T>

Expects that the subject of the assertion (a Map) contains only one entry with a key as defined by keyValue's KeyWithValueCreator.key with a corresponding value which either holds all assertions keyValue's KeyWithValueCreator.valueAssertionCreatorOrNull creates or needs to be null in case KeyWithValueCreator.valueAssertionCreatorOrNull is defined as null

Delegates to it contains o inAny order but only entry keyValue

Parameters

keyValue - The KeyWithValueCreator whose key is expected to be contained within this Map and where the corresponding value holds all assertions the KeyWithValueCreator.valueAssertionCreatorOrNull creates or needs to be null in case KeyWithValueCreator.valueAssertionCreatorOrNull is defined as null -- use the function keyValue(x) { ... } to create a KeyWithValueCreator.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

inline infix fun <K, reified V : Any, T : Map<out K, V?>> Expect<T>.containsOnly(allKeyValues: KeyValues<K, V>): Expect<T>

Expects that the subject of the assertion (a Map) contains only (in any order) for each KeyWithValueCreator in allKeyValues, a key as defined by KeyWithValueCreator.key with a corresponding value which either holds all assertions KeyWithValueCreator's KeyWithValueCreator.valueAssertionCreatorOrNull creates or needs to be null in case KeyWithValueCreator.valueAssertionCreatorOrNull is defined as null

Delegates to it contains o inAny order but only the keyValues

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.