CustomAssertion

Companion:
class
class Object
trait Matchable
class Any

Type members

Classlikes

final class MakePartiallyApplied[A]

Value members

Concrete methods

Creates a SmartAssertion from a function from A to Either[String, B]. Returning Right[A] will transform the input, whereas Left[String] will result in an error with that string as a message.

Creates a SmartAssertion from a function from A to Either[String, B]. Returning Right[A] will transform the input, whereas Left[String] will result in an error with that string as a message.

 sealed trait Color
 case object Red extends Color
 case object Green extends Color
 case object Blue extends Color

 val red: SmartAssertion[Color, Red] =
   SmartAssertion.make[Color] {
     case red: Red => Right(red)
     case _        => Left("Expected Red!")
   }