PaginatedListPresenter { public PaginatedListProvider<TItem> getListProvider() { return mProvider; } PaginatedListPresenter(@NonNull SwipeRefreshLayout refreshLayout,
                                  @NonNull RecyclerView listView); void initializeWithProvider(PaginatedListProvider<TItem> provider); void initializeWithProvider(PaginatedListProvider<TItem> provider, @NonNull Bundle savedInstanceState); void resetAdapterAndRefreshList(); abstract RecyclerViewPaginationAdapter<TItem, ?> getNewInstanceOfListAdapter(List<TItem> initialItems); @Nullable RecyclerViewPaginationAdapter<TItem, ?> getAdapter(); void refreshList(); PaginatedListProvider<TItem> getListProvider(); void onSaveInstanceState(Bundle outState);  }
@Test public void testStateRecovery() { saveAndRestorePresenterState(); assertAdapterItemsAreEqualTo(dummyInitialItems); assertThat(presenter.getListProvider().getCurrentPage(), is(1)); List<MockIntegerParcelable> expectedItems = generatePagesTo(3); saveAndRestorePresenterState(); assertAdapterItemsAreEqualTo(expectedItems); assertThat(presenter.getListProvider().getCurrentPage(), is(3)); }