InterceptSyntax
munit.ZAssertions.InterceptSyntax
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
def interceptDefect[E1 <: Throwable](implicit loc: Location, ct: ClassTag[E1]): ZIO[R, FailExceptionLike[_], E1]
Asserts that ZIO[R, E, Any]
should die with provided exception E
.
Asserts that ZIO[R, E, Any]
should die with provided exception E
.
testZ("effect should die") {
val effect = ZIO.die(new IllegalArgumentException("BOOM!"))
effect.interceptDefect[IllegalArgumentException]
}
For "fail" checking look at interceptFailure
.
Value parameters
- body
-
the effect to be tested
Attributes
def interceptFailure[E1 <: E](implicit loc: Location, ct: ClassTag[E1]): ZIO[R, FailExceptionLike[_], E1]
Asserts that ZIO[R, E, Any]
should fail with provided exception E
.
Asserts that ZIO[R, E, Any]
should fail with provided exception E
.
testZ("effect should fail") {
val effect = ZIO.fail(new IllegalArgumentException("BOOM!"))
effect.interceptFailure[IllegalArgumentException]
}
For "die" checking look at interceptDefect
.
Value parameters
- body
-
the ZIO to be tested
Attributes
def interceptFailureMessage[E1 <: E](message: String)(implicit loc: Location, ct: ClassTag[E1]): ZIO[R, FailExceptionLike[_], E1]
Asserts that ZIO[R, E, Any]
should fail with provided exception E
and message message
.
Asserts that ZIO[R, E, Any]
should fail with provided exception E
and message message
.
testZ("effect should fail with message") {
val effect = ZIO.fail(new IllegalArgumentException("BOOM!"))
interceptFailureMessage[IllegalArgumentException]("BOOM!")(effect)
}
Value parameters
- body
-
the effect to be tested
Attributes
In this article