public final class ExceptionMatchers extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Throwable> |
hasAnyCause(Class<? extends Throwable> expectedClass)
Returns a matcher that verifies that any exception in the stack matches
the finder exists.
|
static <T extends Throwable> |
hasAnyCause(Class<? extends Throwable> expectedClass,
org.hamcrest.Matcher<? extends Throwable> matcher)
Returns a matcher that verifies that any exception in the stack matches
the expected class and also checks that the supplied matcher evaluates to
true.
|
static <T extends Throwable> |
hasAnyCause(org.hamcrest.Matcher<? extends Throwable> finder)
Returns a matcher that verifies that any exception in the stack matches
the finder exists.
|
static <T extends Throwable> |
hasAnyCause(org.hamcrest.Matcher<? extends Throwable> finder,
org.hamcrest.Matcher<? extends Throwable> matcher)
Returns a matcher that verifies that any exception in the stack matches
the finder and also checks that the supplied matcher evaluates to true.
|
static <T extends Throwable> |
hasMessage(org.hamcrest.Matcher<? extends String> matcher)
Returns a matcher that verifies that the exception has a message for
which the supplied matcher evaluates to true.
|
static <T extends Throwable> |
hasMessage(String expectedMessage)
shortcut to:
|
public static <T extends Throwable> org.hamcrest.Matcher<T> hasAnyCause(Class<? extends Throwable> expectedClass)
T
- type of the outer exceptionexpectedClass
- to find the cause in exception stackpublic static <T extends Throwable> org.hamcrest.Matcher<T> hasAnyCause(org.hamcrest.Matcher<? extends Throwable> finder)
T
- type of the outer exceptionfinder
- to find the cause in exception stack, the finder is also the matcherpublic static <T extends Throwable> org.hamcrest.Matcher<T> hasAnyCause(org.hamcrest.Matcher<? extends Throwable> finder, org.hamcrest.Matcher<? extends Throwable> matcher)
T
- type of the outer exceptionfinder
- to find the cause in exception stackmatcher
- to apply to the cause of the outer exceptionpublic static <T extends Throwable> org.hamcrest.Matcher<T> hasAnyCause(Class<? extends Throwable> expectedClass, org.hamcrest.Matcher<? extends Throwable> matcher)
T
- type of the outer exceptionexpectedClass
- to find the cause in exception stackmatcher
- to apply to the cause of the outer exceptionpublic static <T extends Throwable> org.hamcrest.Matcher<T> hasMessage(org.hamcrest.Matcher<? extends String> matcher)
T
- type of the outer exceptionmatcher
- to apply to the cause of the exceptionCopyright © 2021. All rights reserved.