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")
Assuming the result is produced by an effect (in other words, it's wrapped by ZIO), you can use
mapErrorto use thedetailsin case of failure, then assert effectfully usingassertMandfails(containsString):