本文整理汇总了Java中android.support.test.espresso.matcher.ViewMatchers.withText方法的典型用法代码示例。如果您正苦于以下问题:Java ViewMatchers.withText方法的具体用法?Java ViewMatchers.withText怎么用?Java ViewMatchers.withText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.test.espresso.matcher.ViewMatchers
的用法示例。
在下文中一共展示了ViewMatchers.withText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMatcher_doesNotNegateMatcher_when_negateNextMatcher_isFalse
import android.support.test.espresso.matcher.ViewMatchers; //导入方法依赖的package包/类
@Test
public void addMatcher_doesNotNegateMatcher_when_negateNextMatcher_isFalse() {
final Start.Matcher matcher = Cortado.view();
final Cortado cortado = matcher.getCortado();
assertThat(cortado.matchers).hasSize(0);
assertThat(cortado.negateNextMatcher).isFalse();
// no matchers added, negateNextMatcher is false
org.hamcrest.Matcher<View> viewMatcher = ViewMatchers.withText("test");
org.hamcrest.Matcher<View> negatedViewMatcher = Matchers.not(viewMatcher);
cortado.negateNextMatcher = false;
cortado.addMatcher(viewMatcher);
assertThat(cortado.matchers).hasSize(1);
// one matcher added
assertThat(cortado.negateNextMatcher).isFalse();
// negateNextMatcher is still false
final Matcher<? super View> addedMatcher = cortado.matchers.get(0);
Utils.assertThat(addedMatcher).isEqualTo(viewMatcher);
Utils.assertThat(addedMatcher).isNotEqualTo(negatedViewMatcher);
}
示例2: addMatcher_negatesMatcher_when_negateNextMatcher_isTrue
import android.support.test.espresso.matcher.ViewMatchers; //导入方法依赖的package包/类
@Test
public void addMatcher_negatesMatcher_when_negateNextMatcher_isTrue() {
final Start.Matcher matcher = Cortado.view();
final Cortado cortado = matcher.getCortado();
assertThat(cortado.matchers).hasSize(0);
assertThat(cortado.negateNextMatcher).isFalse();
// no matchers added, negateNextMatcher is false
org.hamcrest.Matcher<View> viewMatcher = ViewMatchers.withText("test");
org.hamcrest.Matcher<View> negatedViewMatcher = Matchers.not(viewMatcher);
cortado.negateNextMatcher = true;
cortado.addMatcher(viewMatcher);
assertThat(cortado.matchers).hasSize(1);
// one matcher added
assertThat(cortado.negateNextMatcher).isFalse();
// negateNextMatcher is back to false
final Matcher<? super View> addedMatcher = cortado.matchers.get(0);
Utils.assertThat(addedMatcher).isNotEqualTo(viewMatcher);
Utils.assertThat(addedMatcher).isEqualTo(negatedViewMatcher);
}
示例3: withDigit
import android.support.test.espresso.matcher.ViewMatchers; //导入方法依赖的package包/类
/**
* Helper method that wraps {@link ViewMatchers#withText(String) withText(String)}.
*
* @return A Matcher that matches a number key button by its text representation
* of {@code digit}.
*/
private static Matcher<View> withDigit(int digit) {
// TODO: When we're comfortable with the APIs, we can statically import them and
// make direct calls to these methods and cut down on the verbosity, instead of
// writing helper methods that wrap these APIs.
return ViewMatchers.withText(text(digit));
}