本文整理匯總了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));
}