UserListPresenter implements Presenter { public void onViewDestroyed() { BackgroundExecutor.cancelAll(TASK_ID_GET_USER_LIST, true); }  void setView(UserListView viewListView); void initialize(UserListView userListFragment); void onUserClicked(UserModel userModel); void onViewDestroyed(); static final String TASK_ID_GET_USER_LIST; }
@Test public void testOnViewDestroyed_shouldStopGetUserList() { Robolectric.getBackgroundScheduler().pause(); givenPresenterStartsInitialisation(); userListPresenter.onViewDestroyed(); thenGetUserListWasStopped(); }