org.hamcrest.junit.internal.ThrowableCauseMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hamcrest-junit Show documentation
Show all versions of hamcrest-junit Show documentation
Classes to use Hamcrest matchers within JUnit tests
The newest version!
package org.hamcrest.junit.internal;
import org.hamcrest.*;
public class ThrowableCauseMatcher extends FeatureMatcher {
public ThrowableCauseMatcher(Matcher super Throwable> causeMatcher) {
super(causeMatcher, "exception with cause", "cause");
}
@Override
protected Throwable featureValueOf(Throwable actual) {
return actual.getCause();
}
public static Matcher hasCause(final Matcher super Throwable> matcher) {
return new ThrowableCauseMatcher(matcher);
}
}