Last active
September 7, 2015 00:13
-
-
Save zaki50/03c6b3f213881e6c5e16 to your computer and use it in GitHub Desktop.
Data Binding を使うと Espresso 標準の withText(String) の Matcher が使い物にならなくなるので Data Binding 使用時にも使える withText(String) の実装。Data Binding は Stringではない CharSequence をセットするのが原因。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Matcher<View> withText(final String expectedText) { | |
return new BoundedMatcher<View, TextView>(TextView.class) { | |
@Override | |
public void describeTo(Description description) { | |
description.appendText("with string : "); | |
description.appendValue(expectedText); | |
} | |
@Override | |
public boolean matchesSafely(TextView textView) { | |
return null != expectedText && expectedText.equals(textView.getText().toString()); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment