Given algebraic data type
sealed trait Result
case object Success extends Result
case class MyFailure(details: String) extends Result
How to assert in zio-test that particular value is a Failure and it's details contain a particular substring?
For example how to assert that below r is a Failure and with a "mana" substring?
val r: Result = MyFailure("not enough mana")
It's possible with
isCasesnip:
And my (probably not ideal) solution:
Alternatively it's possible to create a helper function and use it for such cases:
Now the test might look like: