asEntries

infix fun <K, V, T : Map<out K, V>> Expect<T>.asEntries(o: o): Expect<Set<Map.Entry<K, V>>>(source)

Turns Expect<Map<K, V>> into Expect<Set<Map.Entry<K, V>>>.

The transformation as such is not reflected in reporting. Use feature { f(it::entries) } if you want to show the transformation in reporting.

Return

The newly created Expect for the transformed subject.

Samples

expect(mapOf(1 to "a")) asEntries o toEqual mapOf(1 to "a").entries

fails {
    // because <1,"a"> is not equal to <1,"b">
    expect(mapOf(1 to "a")) asEntries o toEqual mapOf(1 to "b").entries
}

infix fun <K, V, T : Map<out K, V>> Expect<T>.asEntries(assertionCreator: Expect<Set<Map.Entry<K, V>>>.() -> Unit): Expect<T>(source)

Turns Expect<Map<K, V>> into Expect<Set<Map.Entry<K, V>>> and expects that it holds all assertions the given assertionCreator creates for it.

The transformation as such is not reflected in reporting. Use feature { f(it::entries) } if you want to show the transformation in reporting.

Return

an Expect for the subject of this expectation.

Samples

expect(mapOf(1 to "a")) asEntries { // subject inside this expectation-group is of type Map.Entry<Int, String> (actually <1,"a">)
    this toEqual mapOf(1 to "a").entries
}

fails {
    expect(mapOf(1 to "a")) asEntries {   // subject inside this expectation-group is of type Map.Entry<Int, String> (actually <1,"a">)
        this toEqual mapOf(1 to "b").entries  // fails because <1,"a"> is not equal to <1,"b">
    }
}