Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Matcher<View> hasValueEqualTo(final String content) {
- return new TypeSafeMatcher<View>() {
- @Override
- public void describeTo(Description description) {
- description.appendText("Has EditText/TextView the value: " + content);
- }
- @Override
- public boolean matchesSafely(View view) {
- if (!(view instanceof TextView) && !(view instanceof EditText)) {
- return false;
- }
- if (view != null) {
- String text;
- if (view instanceof TextView) {
- text = ((TextView) view).getText().toString();
- } else {
- text = ((EditText) view).getText().toString();
- }
- return (text.equalsIgnoreCase(content));
- }
- return false;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement