trait CatsEffectAssertions extends AnyRef
- Self Type
- CatsEffectAssertions with Assertions
- Source
- CatsEffectAssertions.scala
- Alphabetic
- By Inheritance
- CatsEffectAssertions
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- implicit class MUnitCatsAssertionsForIOBooleanOps extends AnyRef
- implicit class MUnitCatsAssertionsForIOOps[A] extends AnyRef
- implicit class MUnitCatsAssertionsForIOUnitOps extends AnyRef
- implicit class MUnitCatsAssertionsForSyncIOOps[A] extends AnyRef
- implicit class MUnitCatsAssertionsForSyncIOUnitOps extends AnyRef
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def assertIO[A, B](obtained: IO[A], returns: B, clue: => Any = "values are not the same")(implicit loc: Location, ev: <:<[B, A]): IO[Unit]
Asserts that an
IO
returns an expected value.Asserts that an
IO
returns an expected value.The "returns" value (second argument) must have the same type or be a subtype of the one "contained" inside the
IO
(first argument). For example:assertIO(IO(Option(1)), returns = Some(1)) // OK assertIO(IO(Some(1)), returns = 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.
- obtained
the IO under testing
- returns
the expected value
- clue
a value that will be printed in case the assertions fails
- def assertIOBoolean(obtained: IO[Boolean], clue: => Any = "values are not the same")(implicit loc: Location): IO[Unit]
Asserts that an
IO[Boolean]
returns true.Asserts that an
IO[Boolean]
returns true.For example:
assertIOBoolean(IO(true))
The "clue" value can be used to give extra information about the failure in case the assertion fails.
- obtained
the IO[Boolean] under testing
- clue
a value that will be printed in case the assertions fails
- Attributes
- protected
- def assertIO_(obtained: IO[Unit], clue: => Any = "value is not ()")(implicit loc: Location): IO[Unit]
Asserts that an
IO[Unit]
returns the Unit value.Asserts that an
IO[Unit]
returns the Unit value.For example:
assertIO_(IO.unit)
The "clue" value can be used to give extra information about the failure in case the assertion fails.
- obtained
the IO under testing
- clue
a value that will be printed in case the assertions fails
- Attributes
- protected
- def assertSyncIO[A, B](obtained: SyncIO[A], returns: B, clue: => Any = "values are not the same")(implicit loc: Location, ev: <:<[B, A]): SyncIO[Unit]
Asserts that a
SyncIO
returns an expected value.Asserts that a
SyncIO
returns an expected value.The "returns" value (second argument) must have the same type or be a subtype of the one "contained" inside the
SyncIO
(first argument). For example:assertSyncIO(SyncIO(Option(1)), returns = Some(1)) // OK assertSyncIO(SyncIO(Some(1)), returns = 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.
- obtained
the SyncIO under testing
- returns
the expected value
- clue
a value that will be printed in case the assertions fails
- def assertSyncIO_(obtained: SyncIO[Unit], clue: => Any = "value is not ()")(implicit loc: Location): SyncIO[Unit]
Asserts that a
SyncIO[Unit]
returns the Unit value.Asserts that a
SyncIO[Unit]
returns the Unit value.For example:
assertSyncIO_(SyncIO.unit) // OK
The "clue" value can be used to give extra information about the failure in case the assertion fails.
- obtained
the SyncIO under testing
- clue
a value that will be printed in case the assertions fails
- Attributes
- protected
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def interceptIO[T <: Throwable](io: IO[Any])(implicit T: ClassTag[T], loc: Location): IO[T]
Intercepts a
Throwable
being thrown inside the providedIO
.Intercepts a
Throwable
being thrown inside the providedIO
.val io = IO.raiseError[Unit](MyException("BOOM!")) interceptIO[MyException](io)
or
interceptIO[MyException] { IO.raiseError[Unit](MyException("BOOM!")) }
Example: - def interceptMessageIO[T <: Throwable](expectedExceptionMessage: String)(io: IO[Any])(implicit T: ClassTag[T], loc: Location): IO[T]
Intercepts a
Throwable
with a certain message being thrown inside the providedIO
.Intercepts a
Throwable
with a certain message being thrown inside the providedIO
.val io = IO.raiseError[Unit](MyException("BOOM!")) interceptIO[MyException]("BOOM!")(io)
or
interceptIO[MyException] { IO.raiseError[Unit](MyException("BOOM!")) }
Example: - def interceptMessageSyncIO[T <: Throwable](expectedExceptionMessage: String)(io: SyncIO[Any])(implicit T: ClassTag[T], loc: Location): SyncIO[T]
Intercepts a
Throwable
with a certain message being thrown inside the providedSyncIO
.Intercepts a
Throwable
with a certain message being thrown inside the providedSyncIO
.val io = SyncIO.raiseError[Unit](MyException("BOOM!")) interceptSyncIO[MyException]("BOOM!")(io)
or
interceptSyncIO[MyException] { SyncIO.raiseError[Unit](MyException("BOOM!")) }
Example: - def interceptSyncIO[T <: Throwable](io: SyncIO[Any])(implicit T: ClassTag[T], loc: Location): SyncIO[T]
Intercepts a
Throwable
being thrown inside the providedSyncIO
.Intercepts a
Throwable
being thrown inside the providedSyncIO
.val io = SyncIO.raiseError[Unit](MyException("BOOM!")) interceptSyncIO[MyException](io)
or
interceptSyncIO[MyException] { SyncIO.raiseError[Unit](MyException("BOOM!")) }
Example: - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()