org.junit.experimental.results.ResultMatchers Maven / Gradle / Ivy
Go to download
JUnit is a regression testing framework written by Erich Gamma and Kent Beck.
It is used by the developer who implements unit tests in Java.
package org.junit.experimental.results;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.junit.internal.matchers.TypeSafeMatcher;
public class ResultMatchers {
public static Matcher isSuccessful() {
return failureCountIs(0);
}
public static Matcher failureCountIs(final int count) {
return new TypeSafeMatcher() {
public void describeTo(Description description) {
description.appendText("has " + count + " failures");
}
@Override
public boolean matchesSafely(PrintableResult item) {
return item.getFailures().size() == count;
}
};
}
public static Matcher