Android UI Test — Espresso Matcher for ImageView
Daniele Bottillo
21917

Very good! Congratulations.

Just an improvement. You can make it more general for use with whatever view that has a background Drawable.

@Override
protected boolean matchesSafely(View item) {
Resources resources = item.getContext().getResources();
Drawable expectedDrawable = resources.getDrawable(expectedId);

if (expectedDrawable == null) return false;
Drawable itemDrawable = item.getBackground();
    return itemDrawable.getConstantState()
.equals(expectedDrawable.getConstantState());
}
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.