These matchers can be used to check if exceptions are thrown or not
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait ExpectationsCreationtrait ResultCheckstrait MatchResultStackTraceclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object ExceptionMatchers.typetrait Matchersobject Matchers.typetrait MustMatchersobject MustMatchers.typetrait MustThrownMatchersobject MustThrownMatchers.typetrait ShouldMatchersobject ShouldMatchers.typetrait ShouldThrownMatchersobject ShouldThrownMatchers.typeShow all
Members list
Type members
Classlikes
An exception matcher checks if an expression throws some specified exceptions:
An exception matcher checks if an expression throws some specified exceptions:
- by checking the type of exception
- if no exception is thrown it returns a success
- if an exception is thrown with with a subtype of java.lang.Error and we expect an Exception then it is re-thrown
- if an exception is thrown with a different type it returns a failure
- by checking the exception message
- by checking a condition on the exception
Attributes
- Supertypes
- Self type
Value members
Concrete methods
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
Attributes
Attributes
- Returns
-
a matcher checking the type of an Exception
Attributes
- Returns
-
a matcher checking the type of an Exception and its message (as a regexp)
Attributes
- Returns
-
a matcher checking the value of an Exception
alias for throwA
alias for throwA
Attributes
alias for throwA
alias for throwA
Attributes
alias for throwA
alias for throwA
Attributes
Inherited methods
this method can be overridden to throw exceptions when checking a result
this method can be overridden to throw exceptions when checking a result
Attributes
- Inherited from:
- ResultChecks
Attributes
- Returns
-
an Expectable with a description function
- Inherited from:
- ExpectationsCreation
Attributes
- Returns
-
an Expectable with a description
- Inherited from:
- ExpectationsCreation
Attributes
- Returns
-
an Expectable
- Inherited from:
- ExpectationsCreation
Attributes
- Returns
-
an Expectable with a description function
- Inherited from:
- ExpectationsCreation
Attributes
- Returns
-
an Expectable with a function to show the element T
- Inherited from:
- ExpectationsCreation
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
Attributes
- Inherited from:
- ResultChecks
Attributes
- Returns
-
the result without any side-effects
- Inherited from:
- ResultChecks
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
Attributes
- Inherited from:
- ExpectationsCreation
Attributes
- Inherited from:
- ExpectationsCreation