Skip to content

Instantly share code, notes, and snippets.

@thiagoolsilva
Created August 16, 2017 02:34
Show Gist options
  • Save thiagoolsilva/a1b58d5b9e8272897e42756030f62324 to your computer and use it in GitHub Desktop.
Save thiagoolsilva/a1b58d5b9e8272897e42756030f62324 to your computer and use it in GitHub Desktop.
Creating a custom matcher to be used on espresso
public static Matcher<View> withDummyStatus(final LoginButton.DummyStatus expectedStatus) {
return new BoundedMatcher<View, LoginButton>(LoginButton.class) {
@Override
public void describeTo(Description description) {
description.appendText("Checking the matcher on received view: ");
description.appendText("with expectedStatus=" + expectedStatus.toString());
}
@Override
protected boolean matchesSafely(LoginButton foundView) {
return foundView.getDummyLoginStatus() == expectedStatus;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment