toContainOnlyEntriesOf

infix fun <K, V : Any, T : Map<out K, V?>> Expect<T>.toContainOnlyEntriesOf(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 it toContain o inAny order but only entriesOf

Return

an Expect for the subject of this expectation.

Samples

expect(mapOf(1 to "a")) toContainOnlyEntriesOf mapOf(1 to "a")

fails { // because the map contains key 2 with value "b" in addition
    expect(mapOf(1 to "a", 2 to "b")) toContainOnlyEntriesOf mapOf(1 to "a")
}