assertk icon indicating copy to clipboard operation
assertk copied to clipboard

Add containsKey assertion for Map

Open Goooler opened this issue 1 year ago • 3 comments

Goooler avatar Jan 12 '25 08:01 Goooler

The key assertion does this. What's the value add?

jzbrooks avatar Jan 24 '25 20:01 jzbrooks

Inverted for

https://github.com/willowtreeapps/assertk/blob/a69843f4452d2cf83bb6a787b138f8d90cfc3f90/assertk/src/commonMain/kotlin/assertk/assertions/map.kt#L118-L124

Goooler avatar Jan 25 '25 01:01 Goooler

The key assertion asserts that the map contains a key and transforms the assert into an assertion on the value. You don't have to use the latter part of that functionality if you don't want to. The former does the same thing the proposed assertion does.

jzbrooks avatar Jan 25 '25 04:01 jzbrooks