https://kotlinlang.org logo
#kotest
Title
# kotest
l

Lidonis Calhau

04/14/2022, 2:41 PM
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

sam

04/14/2022, 2:43 PM
Try wrapping in
any { }
l

Lidonis Calhau

04/14/2022, 3:09 PM
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

sam

04/14/2022, 3:10 PM
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
*/