org.junit.internal.matchers.Each Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of junit-dep Show documentation
Show all versions of junit-dep Show documentation
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.internal.matchers;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.internal.matchers.IsCollectionContaining.hasItem;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
public class Each {
public static Matcher> each(final Matcher individual) {
final Matcher> allItemsAre = not(hasItem(not(individual)));
return new BaseMatcher>() {
public boolean matches(Object item) {
return allItemsAre.matches(item);
}
public void describeTo(Description description) {
description.appendText("each ");
individual.describeTo(description);
}
};
}
}