@Factory
    public static <T extends Throwable, C extends Throwable> Matcher<T> withCause(final Matcher<C> matcher) {
        return new CustomTypeSafeMatcher<T>(CustomMatchers.fixedDescription("cause ", matcher)) {
            @Override
            protected boolean matchesSafely(T item) {
                return matcher.matches(item.getCause());
            }

            public void describeMismatchSafely(T item, Description mismatchDescription) {
                matcher.describeMismatch(item.getCause(), mismatchDescription);
            }
        };
    }
@ Factory public static < T extends Throwable , C extends Throwable > Matcher < T > withCause ( final Matcher < C > matcher ) { return new CustomTypeSafeMatcher < T > ( CustomMatchers . fixedDescription ( "cause " , matcher ) ) { @ Override protected boolean matchesSafely ( T item ) { return matcher . matches ( item . getCause ( ) ) ; } public void describeMismatchSafely ( T item , Description mismatchDescription ) { matcher . describeMismatch ( item . getCause ( ) , mismatchDescription ) ; } } ; }
Matches if value is a throwable with a cause that matches the <tt>matcher</tt>

@param matcher cause matcher
@param <T> the throwable type
@param <C> the cause throwable type
@return the matcher