ExceptionMatchers

These matchers can be used to check if exceptions are thrown or not

Companion
object
class Object
trait Matchable
class Any

Type members

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.

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

This matchers matches exception instances.

This matchers matches exception instances.

See also

throwA

Value members

Concrete methods

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

a matcher checking the type of an Exception

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)

def throwA[E <: Throwable](e: E): ExceptionMatcher[E]
Returns

a matcher checking the value of an Exception

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

alias for throwA

alias for throwA

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

alias for throwA

alias for throwA

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

alias for throwA

alias for throwA

Inherited methods

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