
ext.test4j.hamcrest.collection.IsEmptyCollection Maven / Gradle / Ivy
package ext.test4j.hamcrest.collection;
import java.util.Collection;
import ext.test4j.hamcrest.Description;
import ext.test4j.hamcrest.Factory;
import ext.test4j.hamcrest.Matcher;
import ext.test4j.hamcrest.TypeSafeMatcher;
/**
* Tests if collection is empty.
*/
public class IsEmptyCollection extends TypeSafeMatcher> {
@Override
public boolean matchesSafely(Collection item) {
return item.isEmpty();
}
@Override
public void describeMismatchSafely(Collection item, Description mismatchDescription) {
mismatchDescription.appendValue(item);
}
public void describeTo(Description description) {
description.appendText("an empty collection");
}
/**
* Matches an empty collection.
*/
@Factory
public static Matcher> empty() {
return new IsEmptyCollection();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy