/**
* Checks if collection has the given number of items.
*/
public static Matcher<Collection<?>> hasItems(final int numberOfItems) {
return new TypeSafeMatcher<Collection<?>>() {
@Override
public boolean matchesSafely(Collection<?> collection) {
if (collection == null || collection.size() != numberOfItems) {
return false;
}
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("expected a collection with "
+ numberOfItems + " items");
}
};
}
JavaMatchers.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:oscm
作者:
评论列表
文章目录