### Question:
ThrowableCauseMatcher extends
        TypeSafeMatcher<T> { @Factory public static <T extends Throwable> Matcher<T> hasCause(final Matcher<? extends Throwable> matcher) { return new ThrowableCauseMatcher<T>(matcher); } ThrowableCauseMatcher(Matcher<? extends Throwable> causeMatcher); void describeTo(Description description); @Factory static Matcher<T> hasCause(final Matcher<? extends Throwable> matcher);  }### Answer:
@Test public void shouldAllowCauseOfDifferentClassFromRoot() throws Exception { NullPointerException expectedCause = new NullPointerException("expected"); Exception actual = new Exception(expectedCause); assertThat(actual, hasCause(is(expectedCause))); }