assertk icon indicating copy to clipboard operation
assertk copied to clipboard

Assert on map should have keys() and values() functions

Open dalewking opened this issue 1 year ago • 2 comments

There are good assertions on individual items in maps but not a clean way to do assertions on all keys or all values in a map. So i propose the following methods be added:

fun <K> Assert<Map<K, *>>.keys() : Assert<Set<K>> = ...

fun <V> Assert<Map<*, V>>.values() : Assert<Collection<V>> = ...

dalewking avatar Apr 17 '24 16:04 dalewking

These will probably be havingKeys() and havingValues() based on the discussion in #522 and #521.

JakeWharton avatar Apr 17 '24 16:04 JakeWharton

These will probably be havingKeys() and havingValues() based on

Makes sense. I care about the functionality, not the name.

dalewking avatar Apr 17 '24 16:04 dalewking