Skip to content

Instantly share code, notes, and snippets.

@dbriones
Created December 6, 2010 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbriones/731195 to your computer and use it in GitHub Desktop.
Save dbriones/731195 to your computer and use it in GitHub Desktop.
private Matcher<? super FavoritesTab> hasCount(final int i) {
final int[] result = new int[1];
return new TypeSafeMatcher<FavoritesTab>() {
protected boolean matchesSafely(FavoritesTab favoritesTab) {
result[0] = favoritesTab.getCountDisplayedOnTab();
return result[0] == i;
}
protected void describeMismatchSafely(FavoritesTab item, Description mismatchDescription) {
mismatchDescription.appendText("it contained " + i + " card(s)");
}
public void describeTo(Description description) {
description.appendText("favorites tab to contain " + result[0] + " cards");
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment