Package org.junit.internal.matchers
Class ThrowableCauseMatcher<T extends Throwable>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<T>
org.junit.internal.matchers.ThrowableCauseMatcher<T>
- Type Parameters:
T
- the type of the throwable being matched
- All Implemented Interfaces:
org.hamcrest.Matcher<T>
,org.hamcrest.SelfDescribing
A matcher that applies a delegate matcher to the cause of the current Throwable, returning the result of that
match.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
describeMismatchSafely
(T item, org.hamcrest.Description description) void
describeTo
(org.hamcrest.Description description) static <T extends Throwable>
org.hamcrest.Matcher<T> hasCause
(org.hamcrest.Matcher<?> matcher) Returns a matcher that verifies that the outer exception has a cause for which the supplied matcher evaluates to true.protected boolean
matchesSafely
(T item) Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, matches
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
-
Field Details
-
causeMatcher
private final org.hamcrest.Matcher<?> causeMatcher
-
-
Constructor Details
-
ThrowableCauseMatcher
public ThrowableCauseMatcher(org.hamcrest.Matcher<?> causeMatcher)
-
-
Method Details
-
describeTo
public void describeTo(org.hamcrest.Description description) -
matchesSafely
-
describeMismatchSafely
-
hasCause
public static <T extends Throwable> org.hamcrest.Matcher<T> hasCause(org.hamcrest.Matcher<?> matcher) Returns a matcher that verifies that the outer exception has a cause for which the supplied matcher evaluates to true.- Type Parameters:
T
- type of the outer exception- Parameters:
matcher
- to apply to the cause of the outer exception
-