### Question:
StacktracePrintingMatcher extends
        org.hamcrest.TypeSafeMatcher<T> { @Factory public static <T extends Throwable> Matcher<T> isThrowable( Matcher<T> throwableMatcher) { return new StacktracePrintingMatcher<T>(throwableMatcher); } StacktracePrintingMatcher(Matcher<T> throwableMatcher); void describeTo(Description description); @Factory static Matcher<T> isThrowable(
            Matcher<T> throwableMatcher); @Factory static Matcher<T> isException(
            Matcher<T> exceptionMatcher);  }### Answer:
@Test public void succeedsWhenInnerMatcherSucceeds() throws Exception { assertTrue(isThrowable(any(Throwable.class)).matches(new Exception())); }
@Test public void assertThatIncludesStacktrace() { Exception actual = new IllegalArgumentException("my message"); Exception expected = new NullPointerException(); try { assertThat(actual, isThrowable(equalTo(expected))); } catch (AssertionError e) { assertThat(e.getMessage(), containsString("Stacktrace was: java.lang.IllegalArgumentException: my message")); } }