ExceptionMatchers

org.specs2.matcher.ExceptionMatchers
See theExceptionMatchers companion object

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

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ExceptionMatchers.type
trait Matchers
object Matchers.type
trait MustMatchers
object MustMatchers.type
object MustThrownMatchers.type
object ShouldMatchers.type
object ShouldThrownMatchers.type
Show all

Members list

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.

Attributes

Inherited from:
ExceptionBaseMatchers (hidden)
Supertypes
trait Matcher[Any]
class Object
trait Matchable
class Any
class ExceptionMatcher[E <: Throwable](exception: E) extends Matcher[Any]

This matchers matches exception instances.

This matchers matches exception instances.

Attributes

See also

throwA

Inherited from:
ExceptionBaseMatchers (hidden)
Supertypes
trait Matcher[Any]
class Object
trait Matchable
class Any
implicit class ExceptionMatcherResult[T](result: MatchResult[T])

Attributes

Inherited from:
ExceptionBeHaveMatchers (hidden)
Supertypes
class Object
trait Matchable
class Any

Value members

Inherited methods

def be: NeutralMatcher[Any]

Attributes

Inherited from:
BeHaveMatchers (hidden)
protected def checkFailure[T](m: MatchResult[T]): MatchResult[T]

this method can be overridden to throw exceptions when checking the match result

this method can be overridden to throw exceptions when checking the match result

Attributes

Inherited from:
ExpectationsCreation
protected def checkMatchResultFailure[T](m: MatchResult[T]): MatchResult[T]

this method can be overridden to throw exceptions when checking the match result

this method can be overridden to throw exceptions when checking the match result

Attributes

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

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

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

Attributes

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

Attributes

Returns

an Expectable with a description function

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

Attributes

Returns

an Expectable with a description function

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

Attributes

Returns

an Expectable with a description

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

Attributes

Returns

an Expectable

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

Attributes

Returns

an Expectable with a function to show the element T

Inherited from:
ExpectationsCreation
def have: NeutralMatcher[Any]

Attributes

Inherited from:
BeHaveMatchers (hidden)
protected def mapMatchResult[T](m: MatchResult[T]): MatchResult[T]

this method can be overridden to intercept a MatchResult and change its message before it is thrown

this method can be overridden to intercept a MatchResult and change its message before it is thrown

Attributes

Inherited from:
ExpectationsCreation
def not: NotMatcher[Any]

Attributes

Inherited from:
BeHaveMatchers (hidden)
protected def sandboxMatchResult[T](mr: => MatchResult[T]): MatchResult[T]

Attributes

Returns

the match result without any side-effects

Inherited from:
ExpectationsCreation
protected def setStacktrace[T](m: MatchResult[T]): MatchResult[T]

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

Attributes

Inherited from:
MatchResultStackTrace
def throwA[E <: Throwable](e: E): ExceptionMatcher[E]

Attributes

Returns

a matcher checking the value of an Exception

Inherited from:
ExceptionBaseMatchers (hidden)
def throwA[E <: Throwable](message: String)(implicit m: ClassTag[E]): Matcher[Any]

Attributes

Returns

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

Inherited from:
ExceptionBaseMatchers (hidden)
def throwA[E <: Throwable](implicit m: ClassTag[E]): ExceptionClassMatcher

Attributes

Returns

a matcher checking the type of an Exception

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

alias for throwA

alias for throwA

Attributes

Inherited from:
ExceptionBaseMatchers (hidden)
def throwAn[E <: Throwable](message: String)(implicit m: ClassTag[E]): Matcher[Any]

alias for throwA

alias for throwA

Attributes

Inherited from:
ExceptionBaseMatchers (hidden)
def throwAn[E <: Throwable](implicit m: ClassTag[E]): ExceptionClassMatcher

alias for throwA

alias for throwA

Attributes

Inherited from:
ExceptionBaseMatchers (hidden)

Implicits

Inherited implicits

final implicit def ExceptionMatcherResult[T](result: MatchResult[T]): ExceptionMatcherResult[T]

Attributes

Inherited from:
ExceptionBeHaveMatchers (hidden)