@Test public void shouldShowAllFavouriteCinemaListWhenInitialize(){ presenter.setView(view); List<Cinema> cinemaList = new ArrayList<>(); Cinema testCinema = new Cinema(); testCinema.setCharacter("Thor"); cinemaList.add(testCinema); doReturn(Maybe.just(cinemaList)).when(repository).getFavouriteListCinema(); presenter.initialize(); testScheduler.triggerActions(); verify(view).showLoading(); verify(view).showFavouriteListCinema(cinemaList); }
@Override public void initialize() { getView().showLoading(); getView().showSavedSortedPosition(sharedPreferenceManager.getCinemaSortingPosition()); useCaseFavouriteListCinema.subscribe(new DisposableSubscriber<List<Cinema>>() { @Override public void onNext(List<Cinema> cinemas) { cinemaList = cinemas; removeNotNecessaryInfoFromCinemaList(cinemaList); checkForEmptyList(cinemaList); } @Override public void onError(Throwable t) { t.printStackTrace(); getView().hideLoading(); } @Override public void onComplete() { getView().hideLoading(); } }); }
FavouriteListCinemaPresenter extends BasePresenter<FavouriteListCinemaPresenter.View> { @Override public void initialize() { getView().showLoading(); getView().showSavedSortedPosition(sharedPreferenceManager.getCinemaSortingPosition()); useCaseFavouriteListCinema.subscribe(new DisposableSubscriber<List<Cinema>>() { @Override public void onNext(List<Cinema> cinemas) { cinemaList = cinemas; removeNotNecessaryInfoFromCinemaList(cinemaList); checkForEmptyList(cinemaList); } @Override public void onError(Throwable t) { t.printStackTrace(); getView().hideLoading(); } @Override public void onComplete() { getView().hideLoading(); } }); } }
FavouriteListCinemaPresenter extends BasePresenter<FavouriteListCinemaPresenter.View> { @Override public void initialize() { getView().showLoading(); getView().showSavedSortedPosition(sharedPreferenceManager.getCinemaSortingPosition()); useCaseFavouriteListCinema.subscribe(new DisposableSubscriber<List<Cinema>>() { @Override public void onNext(List<Cinema> cinemas) { cinemaList = cinemas; removeNotNecessaryInfoFromCinemaList(cinemaList); checkForEmptyList(cinemaList); } @Override public void onError(Throwable t) { t.printStackTrace(); getView().hideLoading(); } @Override public void onComplete() { getView().hideLoading(); } }); } FavouriteListCinemaPresenter(GetFavouriteListCinema useCaseFavouriteListCinema ,
                                        SharedPreferenceManager sharedPreferenceManager); }
FavouriteListCinemaPresenter extends BasePresenter<FavouriteListCinemaPresenter.View> { @Override public void initialize() { getView().showLoading(); getView().showSavedSortedPosition(sharedPreferenceManager.getCinemaSortingPosition()); useCaseFavouriteListCinema.subscribe(new DisposableSubscriber<List<Cinema>>() { @Override public void onNext(List<Cinema> cinemas) { cinemaList = cinemas; removeNotNecessaryInfoFromCinemaList(cinemaList); checkForEmptyList(cinemaList); } @Override public void onError(Throwable t) { t.printStackTrace(); getView().hideLoading(); } @Override public void onComplete() { getView().hideLoading(); } }); } 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(); }
FavouriteListCinemaPresenter extends BasePresenter<FavouriteListCinemaPresenter.View> { @Override public void initialize() { getView().showLoading(); getView().showSavedSortedPosition(sharedPreferenceManager.getCinemaSortingPosition()); useCaseFavouriteListCinema.subscribe(new DisposableSubscriber<List<Cinema>>() { @Override public void onNext(List<Cinema> cinemas) { cinemaList = cinemas; removeNotNecessaryInfoFromCinemaList(cinemaList); checkForEmptyList(cinemaList); } @Override public void onError(Throwable t) { t.printStackTrace(); getView().hideLoading(); } @Override public void onComplete() { getView().hideLoading(); } }); } 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();  }