com.pivotallabs.greatexpectations.matchers.SetMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of great-expectations Show documentation
Show all versions of great-expectations Show documentation
Jasmine-style expect() for Java.
The newest version!
package com.pivotallabs.greatexpectations.matchers;
import com.pivotallabs.greatexpectations.MatcherOf;
import java.util.Set;
@MatcherOf(value = Set.class, directObject = true)
public class SetMatcher, X, M extends SetMatcher> extends ObjectMatcher {
public boolean toContain(X... expectedItems) {
for (X expectedItem : expectedItems) {
if (!actual.contains(expectedItem)) return false;
}
return true;
}
public boolean toContainExactly(X... expectedItems) {
for (X x : expectedItems) {
if (!actual.contains(x)) {
return false;
}
}
return actual.size() == expectedItems.length;
}
public boolean toBeEmpty() {
return actual.isEmpty();
}
public boolean toNumber(int expectedCount) {
return actual.size() == expectedCount;
}
}