FavouriteListCinemaPresenter extends BasePresenter<FavouriteListCinemaPresenter.View> { @SuppressLint("CheckResult") public void onMenuClearFavouriteListClicked() { cinemaList.clear(); useCaseFavouriteListCinema .clearFavouriteList() .subscribe(getView()::showSuccessfullyFavouriteListCleared); getView().showEmptyScreen(); } FavouriteListCinemaPresenter(GetFavouriteListCinema useCaseFavouriteListCinema ,
                                        SharedPreferenceManager sharedPreferenceManager); @Override void initialize(); void onCinemaClicked(int cinemaId , int viewHolderPos); @SuppressLint("CheckResult") void onCinemaSwiped(int position); @SuppressLint("CheckResult") void onMenuClearFavouriteListClicked(); void onUndoClicked(Cinema deletedCinema, int deletedIndex); void setCinemaList(List<Cinema> cinemaList); void onCinemaSortingDialogItemClicked(int position); @Override void onDestroy();  }
@Test public void shouldClearAllFavouriteCinemaListWhenOnClearBtnClicked(){ presenter.setView(view); doReturn(Completable.complete()).when(repository).clearFavouriteListCinema(); presenter.onMenuClearFavouriteListClicked(); testScheduler.triggerActions(); useCaseGetFavouriteListCinema.clearFavouriteList() .test() .assertSubscribed() .onComplete(); verify(view).showSuccessfullyFavouriteListCleared(); }