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

containsOnlyEntriesOf

fun <K, V : Any, T : Map<out K, V?>> Expect<T>.containsOnlyEntriesOf(mapLike: MapLike): Expect<T> (source)

Expects that the subject of this expectation (a Map) contains only (in any order) the key-value pairs of the given mapLike.

Delegates to contains.inAnyOrder.only.entriesOf

expect(mapOf(1 to "a")).containsOnlyEntriesOf(listOf(1 to "a"))

fails {
    expect(mapOf(1 to "a", 1 to "b"))
        .containsOnlyEntriesOf(listOf(1 to "a")) // fails because the map does not contain only <1,"a">
}

Return
an Expect for the subject of this expectation.