Closed nukeforum closed 8 months ago
In the same way that isNull
is a terminal assertion while isNotNull
is both an assertion and transformation, doesNotContainKey
is a terminal assertion while key
is an assertion and transformation.
I would not expect this to be a terminal operation. It operates on the contents of the map which does not preclude additional assertions on it.
... which does not preclude additional assertions on it.
@JakeWharton
Isn't that what the .all {}
extension is for? I'm actually pretty new to assertK, so I could use some context to understand your feedback. 🙏
Sorry yeah you're right. I've been working on a different testing library in Rust and it's been screwing up my knowledge of AssertK now multiple times today 🤦♂️
This does make me wonder if it's worth renaming key()
to containsKey()
, would make it more clear it's an assertion itself, but maybe it makes it slightly less clear that chaining targets the specific value, kinda 50/50 on it.
Just adding a convenience assertion
Map::doesNotContainKey
. While existing assertions onMap
can achieve the same functionality, having to pass an arbitrary value in addition to the key to be checked is overhead this PR endeavors to eliminate.