mercredi 1 février 2017

How to test scrolling of RecyclerView with Robolectric?

I want to test RecyclerView with Robolectric My test:

ActivityController<MyActivity> activityController =
            Robolectric.buildActivity(MyActivity.class);
RecyclerView recyclerView = ButterKnife
            .findById(activityController.get(), R.id.recycler_view);

recyclerView.measure(0, 0);
recyclerView.layout(0, 0, 100, 1000);

activityController.get().showData(data);//list of size 30
recyclerView.getLayoutManager().scrollToPosition(29);

verify(presenter).getDataPagination(any());

But test is failed

Aucun commentaire:

Enregistrer un commentaire