MUnitCatsAssertionsForIOOps

class MUnitCatsAssertionsForIOOps[A](io: IO[A])
class Object
trait Matchable
class Any

Value members

Concrete methods

def assertEquals[B](expected: B, clue: => Any)(implicit loc: Location, ev: B <:< A): IO[Unit]

Asserts that this effect returns an expected value.

Asserts that this effect returns an expected value.

The "expected" value (second argument) must have the same type or be a subtype of the one "contained" inside the effect. For example:

 IO(Option(1)).assertEquals(Some(1)) // OK
 IO(Some(1)).assertEquals(Option(1)) // Error: Option[Int] is not a subtype of Some[Int]

The "clue" value can be used to give extra information about the failure in case the assertion fails.

Value Params
clue

a value that will be printed in case the assertions fails

expected

the expected value

def intercept[T <: Throwable](implicit T: ClassTag[T], loc: Location): IO[T]

Intercepts a Throwable being thrown inside this effect.

Intercepts a Throwable being thrown inside this effect.

Example
 val io = IO.raiseError[Unit](MyException("BOOM!"))
 io.intercept[MyException]
def interceptMessage[T <: Throwable](expectedExceptionMessage: String)(implicit T: ClassTag[T], loc: Location): IO[T]

Intercepts a Throwable with a certain message being thrown inside this effect.

Intercepts a Throwable with a certain message being thrown inside this effect.

Example
 val io = IO.raiseError[Unit](MyException("BOOM!"))
 io.intercept[MyException]("BOOM!")