com.vtence.molecule.lib.matchers.AllOf Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of molecule Show documentation
Show all versions of molecule Show documentation
A web micro-framework for Java
package com.vtence.molecule.lib.matchers;
import java.util.Arrays;
public class AllOf implements Matcher {
private final Iterable> matchers;
public AllOf(Iterable> matchers) {
this.matchers = matchers;
}
public boolean matches(T actual) {
for (Matcher super T> matcher : matchers) {
if (!matcher.matches(actual)) return false;
}
return true;
}
@SuppressWarnings("unchecked")
public static Matcher allOf(Matcher super T>... matchers) {
return new AllOf<>(Arrays.asList(matchers));
}
}