本文整理汇总了Java中android.support.test.espresso.core.deps.guava.base.Preconditions类的典型用法代码示例。如果您正苦于以下问题:Java Preconditions类的具体用法?Java Preconditions怎么用?Java Preconditions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Preconditions类属于android.support.test.espresso.core.deps.guava.base包,在下文中一共展示了Preconditions类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import android.support.test.espresso.core.deps.guava.base.Preconditions; //导入依赖的package包/类
public KeyboardTypeAction add(String stringToBeTyped) {
Preconditions.checkNotNull(stringToBeTyped);
appendDescription(stringToBeTyped);
for (char c : stringToBeTyped.toCharArray()) {
if (c == '\n') {
keysToBeHit.add(KeyLocations.instance().findSpecial(KeyEvent.KEYCODE_ENTER));
} else {
if (Character.isUpperCase(c)) {
keysToBeHit.add(KeyLocations.instance().findSpecial(KeyEvent.KEYCODE_SHIFT_LEFT));
c = Character.toLowerCase(c);
}
try {
keysToBeHit.add(KeyLocations.instance().findStandard(c));
} catch (IllegalStateException e) {
if (fallbackToInjection) {
Log.w(TAG, "Using fallback for " + c);
keysToBeHit.add(KeyInfo.getFallbackKey("" + c));
} else {
throw e;
}
}
}
}
return this;
}
示例2: isDisplayingAtLeast
import android.support.test.espresso.core.deps.guava.base.Preconditions; //导入依赖的package包/类
/**
* Assume visible area percentage.
*
* There is an bug on pre Android v11 versions where actionbar height can't be resolved when
* using appcompat actionbar. This method use the appcompat actionbar height attribute when
* on pre v11 versions.
*
* @see ViewMatchers#isDisplayingAtLeast(int)
*/
public static Matcher<View> isDisplayingAtLeast(final int areaPercentage) {
Preconditions.checkState(areaPercentage <= 100, "Cannot have over 100 percent: %s", areaPercentage);
Preconditions.checkState(areaPercentage > 0, "Must have a positive, non-zero value: %s", areaPercentage);
return new IsDisplayingAtLeastMatcher(areaPercentage);
}