org.hamcrest.junit.internal.ThrowableMessageMatcher 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 ThrowableMessageMatcher extends FeatureMatcher {
public ThrowableMessageMatcher(Matcher super String> subMatcher) {
super(subMatcher, "exception with message", "message");
}
@Override
protected String featureValueOf(Throwable actual) {
return actual.getMessage();
}
public static Matcher hasMessage(final Matcher super String> matcher) {
return new ThrowableMessageMatcher(matcher);
}
}