本文整理汇总了Java中android.support.test.espresso.core.deps.guava.base.Predicate类的典型用法代码示例。如果您正苦于以下问题:Java Predicate类的具体用法?Java Predicate怎么用?Java Predicate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Predicate类属于android.support.test.espresso.core.deps.guava.base包,在下文中一共展示了Predicate类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: containsWithValue
import android.support.test.espresso.core.deps.guava.base.Predicate; //导入依赖的package包/类
private Matcher<? super List<HttpHeaderValue>> containsWithValue(final String value) {
return new CustomTypeSafeMatcher<List<HttpHeaderValue>>("contains with value:" + value) {
@Override
protected boolean matchesSafely(List<HttpHeaderValue> list) {
return any(list, new Predicate<HttpHeaderValue>() {
@Override
public boolean apply(@Nullable HttpHeaderValue httpHeaderValue) {
return httpHeaderValue.getValue().equals(value);
}
});
}
};
}
示例2: RelativeMatcher
import android.support.test.espresso.core.deps.guava.base.Predicate; //导入依赖的package包/类
private RelativeMatcher(Matcher<View> target, DoublePredicate<View> predicate, String description, Type type) {
mTarget = target;
mTargetPredicate = new Predicate<View>() {
@Override
public boolean apply(@Nullable View view) {
return mTarget.matches(view);
}
};
mPredicate = predicate;
mDescription = description;
mType = type;
}
示例3: matchesSafely
import android.support.test.espresso.core.deps.guava.base.Predicate; //导入依赖的package包/类
@Override
public boolean matchesSafely(final View testView) {
if (!mTargetPredicate.apply(testView))
return false;
Predicate<View> pred = new Predicate<View>() {
@Override
public boolean apply(@Nullable View targetView) {
return mPredicate.apply(testView, targetView);
}
};
Iterable<View> traversal = Iterables.filter(breadthFirstViewTraversal(testView.getRootView()), new Predicate<View>() {
@Override
public boolean apply(@Nullable View input) {
return input != testView && mTargetPredicate.apply(input);
}
});
if (Iterables.isEmpty(traversal)) {
throw new NoMatchingViewException.Builder().withViewMatcher(mTarget).build(); // TODO: build an actual err msg
}
switch (mType) {
case ANY: return Iterables.any(traversal, pred);
case ALL: return Iterables.all(traversal, pred);
case NONE: return !Iterables.any(traversal, pred);
default: throw new IllegalStateException("impossible mType");
}
}