use of io.github.hidroh.materialistic.test.ListActivity in project materialistic by hidroh.
the class ListFragmentViewHolderEdgeTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
TestApplication.applicationGraph.inject(this);
reset(itemManager);
controller = Robolectric.buildActivity(ListActivity.class).create().start().resume().visible();
ListActivity activity = controller.get();
Bundle args = new Bundle();
args.putString(ListFragment.EXTRA_ITEM_MANAGER, HackerNewsClient.class.getName());
args.putString(ListFragment.EXTRA_FILTER, ItemManager.TOP_FETCH_MODE);
activity.getSupportFragmentManager().beginTransaction().add(android.R.id.content, Fragment.instantiate(activity, ListFragment.class.getName(), args)).commit();
verify(itemManager).getStories(any(), eq(ItemManager.MODE_DEFAULT), storiesListener.capture());
storiesListener.getValue().onResponse(new Item[] { new TestHnItem(1L) });
RecyclerView recyclerView = (RecyclerView) activity.findViewById(R.id.recycler_view);
ShadowRecyclerViewAdapter shadowAdapter = customShadowOf(recyclerView.getAdapter());
holder = shadowAdapter.getViewHolder(0);
}
Aggregations