ExceptionMatchers

Companion:
class
class Object
trait Matchable
class Any

Type members

Inherited classlikes

class ExceptionClassMatcher(klass: Class[_]) extends Matcher[Any]

Exception matcher checking the type of a thrown exception.

Exception matcher checking the type of a thrown exception.

Inherited from:
ExceptionMatchers
class ExceptionMatcher[E <: Throwable](exception: E) extends Matcher[Any]

This matchers matches exception instances.

This matchers matches exception instances.

See also:

throwA

Inherited from:
ExceptionMatchers

Value members

Inherited methods

def beException[T](message: String)(using evidence$1: ClassTag[T]): Matcher[Throwable]

check if a Throwable has a specific class and error message The message must be a regular expression, for example (new IllegalArgumentException("incorrect arguments"): Throwable) must beExceptionIllegalArgumentException

check if a Throwable has a specific class and error message The message must be a regular expression, for example (new IllegalArgumentException("incorrect arguments"): Throwable) must beExceptionIllegalArgumentException

Inherited from:
ExceptionMatchers
protected def checkResultFailure(r: => Result): Result

this method can be overridden to throw exceptions when checking a result

this method can be overridden to throw exceptions when checking a result

Inherited from:
ResultChecks
def createExpectable[T](t: => T, alias: String => String): Expectable[T]
Returns:

an Expectable with a description function

Inherited from:
ExpectationsCreation
def createExpectable[T](t: => T, alias: => String): Expectable[T]
Returns:

an Expectable with a description

Inherited from:
ExpectationsCreation
def createExpectable[T](t: => T): Expectable[T]
Returns:

an Expectable

Inherited from:
ExpectationsCreation
def createExpectable[T](t: => T, alias: Option[String => String]): Expectable[T]
Returns:

an Expectable with a description function

Inherited from:
ExpectationsCreation
def createExpectableWithShowAs[T](t: => T, showAs: => String): Expectable[T]
Returns:

an Expectable with a function to show the element T

Inherited from:
ExpectationsCreation
protected def mapResult(r: Result): Result

this method can be overridden to intercept a Result and modify it. It is used for example to set a stacktrace providing the location of a failure

this method can be overridden to intercept a Result and modify it. It is used for example to set a stacktrace providing the location of a failure

Inherited from:
ResultChecks
protected def sandboxResult(r: => Result): Result
Returns:

the result without any side-effects

Inherited from:
ResultChecks
protected def setStacktrace(m: Result): Result

this method can be overridden to avoid filling-in a stacktrace indicating the location of the result

this method can be overridden to avoid filling-in a stacktrace indicating the location of the result

Inherited from:
MatchResultStackTrace
def theBlock(t: => Nothing): Expectable[Nothing]
Inherited from:
ExpectationsCreation
def theValue[T](t: => T): Expectable[T]
Inherited from:
ExpectationsCreation
def throwA[E <: Throwable](e: E): ExceptionMatcher[E]
Returns:

a matcher checking the value of an Exception

Inherited from:
ExceptionMatchers
def throwA[E <: Throwable](message: String)(using m: ClassTag[E]): Matcher[Any]
Returns:

a matcher checking the type of an Exception and its message (as a regexp)

Inherited from:
ExceptionMatchers
def throwA[E <: Throwable](using m: ClassTag[E]): ExceptionClassMatcher
Returns:

a matcher checking the type of an Exception

Inherited from:
ExceptionMatchers
def throwAn[E <: Throwable](e: E): ExceptionMatcher[E]

alias for throwA

alias for throwA

Inherited from:
ExceptionMatchers
def throwAn[E <: Throwable](message: String)(using m: ClassTag[E]): Matcher[Any]

alias for throwA

alias for throwA

Inherited from:
ExceptionMatchers
def throwAn[E <: Throwable](using m: ClassTag[E]): ExceptionClassMatcher

alias for throwA

alias for throwA

Inherited from:
ExceptionMatchers