Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package nl.topicus.jdbc.shaded.org.hamcrest.core;
import nl.topicus.jdbc.shaded.org.hamcrest.Description;
import nl.topicus.jdbc.shaded.org.hamcrest.DiagnosingMatcher;
import nl.topicus.jdbc.shaded.org.hamcrest.Factory;
import nl.topicus.jdbc.shaded.org.hamcrest.Matcher;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Calculates the logical conjunction of multiple matchers. Evaluation is shortcut, so
* subsequent matchers are not called if an earlier matcher returns false.
*/
public class AllOf extends DiagnosingMatcher {
private final Iterable> matchers;
public AllOf(Iterable> matchers) {
this.matchers = matchers;
}
@Override
public boolean matches(Object o, Description mismatch) {
for (Matcher matcher : matchers) {
if (!matcher.matches(o)) {
mismatch.appendDescriptionOf(matcher).appendText(" ");
matcher.describeMismatch(o, mismatch);
return false;
}
}
return true;
}
@Override
public void describeTo(Description description) {
description.appendList("(", " " + "and" + " ", ")", matchers);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
*
*/
@Factory
public static Matcher allOf(Iterable> matchers) {
return new AllOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
*
*/
@Factory
public static Matcher allOf(Matcher... matchers) {
return allOf(Arrays.asList(matchers));
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
*
*/
@Factory
public static Matcher allOf(Matcher first, Matcher second) {
List> matchers = new ArrayList>(2);
matchers.add(first);
matchers.add(second);
return allOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
*
*/
@Factory
public static Matcher allOf(Matcher first, Matcher second, Matcher third) {
List> matchers = new ArrayList>(3);
matchers.add(first);
matchers.add(second);
matchers.add(third);
return allOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
*
*/
@Factory
public static Matcher allOf(Matcher first, Matcher second, Matcher third, Matcher fourth) {
List> matchers = new ArrayList>(4);
matchers.add(first);
matchers.add(second);
matchers.add(third);
matchers.add(fourth);
return allOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ALL of the specified matchers.
*
* For example:
*