当前位置: 首页>>代码示例>>Java>>正文


Java Preconditions类代码示例

本文整理汇总了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;
}
 
开发者ID:evernote,项目名称:kgb,代码行数:30,代码来源:KeyboardTypeAction.java

示例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);
}
 
开发者ID:nenick,项目名称:espresso-macchiato,代码行数:15,代码来源:EspIsDisplayedMatcher.java


注:本文中的android.support.test.espresso.core.deps.guava.base.Preconditions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。