Is there an "or" matcher. I would like to test tha...
# kotest
l
Is there an "or" matcher. I would like to test that a json key is absent or false.
Copy code
shouldContainJsonKeyValue("key", false) or shouldNotContainJsonKeyValue("key")
s
Try wrapping in
any { }
l
It would be what I need but shouldContainJsonKeyValue throws an exception when path is not found so I would use a try catch No so pretty 😞
s
It handles that for you
Copy code
/**
 * Runs multiple assertions and expects at least one to succeed, will suppress all exceptions otherwise.
 *
 *
* any { * "foo" shouldBe "bar" * "foo" shouldBe "foo * "foo" shouldBe "baz" * } *
Copy code
*/