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 org.hamcrest.core;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
/**
* Calculates the logical disjunction of multiple matchers. Evaluation is shortcut, so
* subsequent matchers are not called if an earlier matcher returns true.
*/
public class AnyOf extends ShortcutCombination {
public AnyOf(Iterable> matchers) {
super(matchers);
}
@Override
public boolean matches(Object o) {
return matches(o, true);
}
@Override
public void describeTo(Description description) {
describeTo(description, "or");
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
*
*/
@Factory
public static AnyOf anyOf(Iterable> matchers) {
return new AnyOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
*
*/
@Factory
public static AnyOf anyOf(Matcher super T>... matchers) {
return anyOf(Arrays.asList(matchers));
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
*
*/
@Factory
public static AnyOf anyOf(Matcher first, Matcher super T> second) {
List> matchers = new ArrayList>();
matchers.add(first);
matchers.add(second);
return anyOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
*
*/
@Factory
public static AnyOf anyOf(Matcher first, Matcher super T> second, Matcher super T> third) {
List> matchers = new ArrayList>();
matchers.add(first);
matchers.add(second);
matchers.add(third);
return anyOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
*
*/
@Factory
public static AnyOf anyOf(Matcher first, Matcher super T> second, Matcher super T> third, Matcher super T> fourth) {
List> matchers = new ArrayList>();
matchers.add(first);
matchers.add(second);
matchers.add(third);
matchers.add(fourth);
return anyOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
*
*/
@Factory
public static AnyOf anyOf(Matcher first, Matcher super T> second, Matcher super T> third, Matcher super T> fourth, Matcher super T> fifth) {
List> matchers = new ArrayList>();
matchers.add(first);
matchers.add(second);
matchers.add(third);
matchers.add(fourth);
matchers.add(fifth);
return anyOf(matchers);
}
/**
* Creates a matcher that matches if the examined object matches ANY of the specified matchers.
*
* For example:
*