
flarestar.bdd.assertions.matchers.ContainsAllItemsMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bdd Show documentation
Show all versions of bdd Show documentation
Lightweight mocha/chai/jasmine BDD interface for Java tests.
The newest version!
package flarestar.bdd.assertions.matchers;
import org.hamcrest.Description;
import java.util.Iterator;
/**
* TODO
*/
public class ContainsAllItemsMatcher extends BaseItemMatcher {
private boolean checkExact;
public ContainsAllItemsMatcher(Object[] expectedItems, boolean checkExact) {
super(expectedItems);
this.checkExact = checkExact;
}
public boolean matches(Object o) {
for (int i = 0; i != expectedItems.length; ++i) {
if (!hasItem(o, expectedItems[i])) {
return false;
}
}
if (checkExact) {
return getSize(o) == expectedItems.length;
} else {
return true;
}
}
public void describeTo(Description description) {
description.appendText("array or collection containing all values in ");
description.appendValueList("[", ", ", "]", expectedItems);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy