TestLens

zio.test.TestLens
final case class TestLens[+A]()

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Implicitly added by TestLensAnyOps

Always returns true as long the chain of preceding transformations has succeeded.

Always returns true as long the chain of preceding transformations has succeeded.

 val option: Either[Int, Option[String]] = Right(Some("Cool"))
 assertTrue(option.is(_.right.some.anything)) // returns true
 assertTrue(option.is(_.left.anything)) // will fail because of `.left`.

Attributes

def cause: TestLens[Cause[E]]
Implicitly added by TestLensExitOps

Transforms an Exit to its underlying Cause if it has one, otherwise fails.

Transforms an Exit to its underlying Cause if it has one, otherwise fails.

Attributes

def custom[B](customAssertion: CustomAssertion[A, B]): TestLens[B]
Implicitly added by TestLensAnyOps

Transforms a value with the given CustomAssertion

Transforms a value with the given CustomAssertion

Attributes

Implicitly added by TestLensCauseOps

Transforms a Cause to a scala.Throwable if it is a die, otherwise fails.

Transforms a Cause to a scala.Throwable if it is a die, otherwise fails.

Attributes

Implicitly added by TestLensExitOps

Transforms an Exit to a scala.Throwable if it is a die, otherwise fails.

Transforms an Exit to a scala.Throwable if it is a die, otherwise fails.

Attributes

def failure: TestLens[E]
Implicitly added by TestLensCauseOps

Transforms a Cause to its failure type (E) if it is a fail, otherwise fails.

Transforms a Cause to its failure type (E) if it is a fail, otherwise fails.

Attributes

def failure: TestLens[E]
Implicitly added by TestLensExitOps

Transforms an Exit to its failure type (E) if it is a fail, otherwise fails.

Transforms an Exit to its failure type (E) if it is a fail, otherwise fails.

Attributes

Implicitly added by TestLensCauseOps

Transforms a Cause to a boolean value representing whether or not it was interrupted.

Transforms a Cause to a boolean value representing whether or not it was interrupted.

Attributes

Implicitly added by TestLensExitOps

Transforms an Exit to a boolean value representing whether or not it was interrupted.

Transforms an Exit to a boolean value representing whether or not it was interrupted.

Attributes

def left: TestLens[E]
Implicitly added by TestLensEitherOps

Transforms an scala.Either to its scala.Left value E, otherwise fails if it is a scala.Right.

Transforms an scala.Either to its scala.Left value E, otherwise fails if it is a scala.Right.

Attributes

def right: TestLens[A]
Implicitly added by TestLensEitherOps

Transforms an scala.Either to its scala.Right value A, otherwise fails if it is a scala.Left.

Transforms an scala.Either to its scala.Right value A, otherwise fails if it is a scala.Left.

Attributes

def some: TestLens[A]
Implicitly added by TestLensOptionOps

Transforms an scala.Option to its Some value A, otherwise fails if it is a None.

Transforms an scala.Option to its Some value A, otherwise fails if it is a None.

Attributes

def subtype[Subtype <: A]: TestLens[Subtype]
Implicitly added by TestLensAnyOps

Transforms a value of some type into the given Subtype if possible, otherwise fails.

Transforms a value of some type into the given Subtype if possible, otherwise fails.

 sealed trait CustomError
 case class Explosion(blastRadius: Int) extends CustomError
 case class Melting(degrees: Double) extends CustomError
 case class Fulminating(wow: Boolean) extends CustomError

 val error: CustomError = Melting(100)
 assertTrue(option.is(_.subtype[Melting]).degrees > 10) // succeeds
 assertTrue(option.is(_.subtype[Explosion]).blastRadius == 12) // fails

Attributes

def success: TestLens[A]
Implicitly added by TestLensExitOps

Transforms an Exit to its success type (A) if it is a succeed, otherwise fails.

Transforms an Exit to its success type (A) if it is a succeed, otherwise fails.

Attributes

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product