@Test public void loadDayForecast() { when(mRepository.getForecast(WEATHER_LIST.get(0).getCity_id().intValue(), WEATHER_LIST.get(0).getDt(), false)) .thenReturn(Observable.just(WEATHER_LIST)); mPresenter.loadDayForecast(WEATHER_LIST.get(0).getCity_id().intValue(), WEATHER_LIST.get(0).getDt()); verify(mView).addWeathersToList(WEATHER_LIST); }
@Override public void loadDayForecast(int cityId, Date date) { mSubscriptions.clear(); Subscription subscription = mRepository .getForecast(cityId, date, mView.isNetworkAvailable()) .subscribeOn(mBackgroundScheduler) .observeOn(mMainScheduler) .subscribe( ormWeathers -> mView.addWeathersToList(ormWeathers), Throwable::printStackTrace ); mSubscriptions.add(subscription); }
DayWeatherPresenter implements DayWeatherContract.Presenter { @Override public void loadDayForecast(int cityId, Date date) { mSubscriptions.clear(); Subscription subscription = mRepository .getForecast(cityId, date, mView.isNetworkAvailable()) .subscribeOn(mBackgroundScheduler) .observeOn(mMainScheduler) .subscribe( ormWeathers -> mView.addWeathersToList(ormWeathers), Throwable::printStackTrace ); mSubscriptions.add(subscription); } }
DayWeatherPresenter implements DayWeatherContract.Presenter { @Override public void loadDayForecast(int cityId, Date date) { mSubscriptions.clear(); Subscription subscription = mRepository .getForecast(cityId, date, mView.isNetworkAvailable()) .subscribeOn(mBackgroundScheduler) .observeOn(mMainScheduler) .subscribe( ormWeathers -> mView.addWeathersToList(ormWeathers), Throwable::printStackTrace ); mSubscriptions.add(subscription); } DayWeatherPresenter(DayWeatherContract.View view, RepositoryDataSource repository,
                               Scheduler background, Scheduler main); }
DayWeatherPresenter implements DayWeatherContract.Presenter { @Override public void loadDayForecast(int cityId, Date date) { mSubscriptions.clear(); Subscription subscription = mRepository .getForecast(cityId, date, mView.isNetworkAvailable()) .subscribeOn(mBackgroundScheduler) .observeOn(mMainScheduler) .subscribe( ormWeathers -> mView.addWeathersToList(ormWeathers), Throwable::printStackTrace ); mSubscriptions.add(subscription); } DayWeatherPresenter(DayWeatherContract.View view, RepositoryDataSource repository,
                               Scheduler background, Scheduler main); @Override void loadDayForecast(int cityId, Date date); @Override void subscribe(); @Override void unsubscribe(); }
DayWeatherPresenter implements DayWeatherContract.Presenter { @Override public void loadDayForecast(int cityId, Date date) { mSubscriptions.clear(); Subscription subscription = mRepository .getForecast(cityId, date, mView.isNetworkAvailable()) .subscribeOn(mBackgroundScheduler) .observeOn(mMainScheduler) .subscribe( ormWeathers -> mView.addWeathersToList(ormWeathers), Throwable::printStackTrace ); mSubscriptions.add(subscription); } DayWeatherPresenter(DayWeatherContract.View view, RepositoryDataSource repository,
                               Scheduler background, Scheduler main); @Override void loadDayForecast(int cityId, Date date); @Override void subscribe(); @Override void unsubscribe();  }