Skip to content

Instantly share code, notes, and snippets.

@takaiwa
Created May 17, 2016 05:51
Show Gist options
  • Save takaiwa/a9dbf22d8789fc5fb7e31431ffa74836 to your computer and use it in GitHub Desktop.
Save takaiwa/a9dbf22d8789fc5fb7e31431ffa74836 to your computer and use it in GitHub Desktop.
RecyclerViewのリストの並びテストの補足用
public class Item {
String displayName;
public Item(String displayName) {
this.displayName = displayName;
}
public String getDisplayName() {
return displayName;
}
}
List<Item> items = new ArrayList<>();
items.add(new Item("foo"));
items.add(new Item("bar"));
items.add(new Item("hogehoge"));
RecyclerViewInteraction.<Item>onRecyclerView(withId(R.id.recyclerView))
.withItems(items)
.check(new RecyclerViewInteraction.ItemViewAssertion<Item>() {
@Override
public void check(Item item, View view, NoMatchingViewException e) {
matches(hasDescendant(withText(item.getDisplayName())))
.check(view, e);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment