Class StacktracePrintingMatcher<T extends Throwable>

  • All Implemented Interfaces:
    org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing

    public class StacktracePrintingMatcher<T extends Throwable>
    extends org.hamcrest.TypeSafeMatcher<T>
    A matcher that delegates to throwableMatcher and in addition appends the stacktrace of the actual Throwable in case of a mismatch.
    • Constructor Detail

      • StacktracePrintingMatcher

        public StacktracePrintingMatcher​(org.hamcrest.Matcher<T> throwableMatcher)
    • Method Detail

      • describeTo

        public void describeTo​(org.hamcrest.Description description)
      • matchesSafely

        protected boolean matchesSafely​(T item)
        Specified by:
        matchesSafely in class org.hamcrest.TypeSafeMatcher<T extends Throwable>
      • describeMismatchSafely

        protected void describeMismatchSafely​(T item,
                                              org.hamcrest.Description description)
        Overrides:
        describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<T extends Throwable>
      • isThrowable

        public static <T extends Throwable> org.hamcrest.Matcher<T> isThrowable​(org.hamcrest.Matcher<T> throwableMatcher)
      • isException

        public static <T extends Exception> org.hamcrest.Matcher<T> isException​(org.hamcrest.Matcher<T> exceptionMatcher)