Class ThrowableMatcher

java.lang.Object
org.dmfs.jems2.hamcrest.matchers.throwable.ThrowableMatcher

public final class ThrowableMatcher extends Object
A collection of Matchers for Throwables.

TODO: consider implementing a custom Matcher instead of using instanceOf to get better error messages

  • Constructor Details

    • ThrowableMatcher

      public ThrowableMatcher()
  • Method Details

    • throwable

      @SafeVarargs public static org.hamcrest.Matcher<Throwable> throwable(org.hamcrest.Matcher<? super Throwable>... features)
    • throwable

      public static org.hamcrest.Matcher<Throwable> throwable(Class<? extends Throwable> exceptionClass)
    • throwable

      public static org.hamcrest.Matcher<Throwable> throwable(Class<? extends Throwable> exceptionClass, Iterable<org.hamcrest.Matcher<? super Throwable>> features)
    • throwable

      @SafeVarargs public static org.hamcrest.Matcher<Throwable> throwable(Class<? extends Throwable> exceptionClass, org.hamcrest.Matcher<? super Throwable>... features)
    • withMessage

      public static org.hamcrest.Matcher<Throwable> withMessage(org.hamcrest.Matcher<String> messageMatcher)
    • withMessage

      public static org.hamcrest.Matcher<Throwable> withMessage(String message)
    • causedBy

      public static org.hamcrest.Matcher<Throwable> causedBy(org.hamcrest.Matcher<? super Throwable> reasonMatcher)