@Test public void subscribeWithNullTripToEditUpdatesEndDateBasedOnSettings() throws Exception { final TripDatesPresenter presenter = new TripDatesPresenter(tripDateView, userPreferenceManager, null); presenter.subscribe(); verify(dateConsumer).accept(DATE_IN_5_DAYS); }
@Override public void subscribe() { if (editableTrip == null) { compositeDisposable.add(view.getStartDateChanges() .map(date -> new Date(date.getTime() + TimeUnit.DAYS.toMillis(userPreferenceManager.get(UserPreference.General.DefaultReportDuration)))) .subscribe(view.displayEndDate())); } }
TripDatesPresenter extends BasePresenter<TripDateView> { @Override public void subscribe() { if (editableTrip == null) { compositeDisposable.add(view.getStartDateChanges() .map(date -> new Date(date.getTime() + TimeUnit.DAYS.toMillis(userPreferenceManager.get(UserPreference.General.DefaultReportDuration)))) .subscribe(view.displayEndDate())); } } }
TripDatesPresenter extends BasePresenter<TripDateView> { @Override public void subscribe() { if (editableTrip == null) { compositeDisposable.add(view.getStartDateChanges() .map(date -> new Date(date.getTime() + TimeUnit.DAYS.toMillis(userPreferenceManager.get(UserPreference.General.DefaultReportDuration)))) .subscribe(view.displayEndDate())); } } TripDatesPresenter(@NonNull TripDateView view, @NonNull UserPreferenceManager userPreferenceManager, @Nullable Trip editableTrip); }
TripDatesPresenter extends BasePresenter<TripDateView> { @Override public void subscribe() { if (editableTrip == null) { compositeDisposable.add(view.getStartDateChanges() .map(date -> new Date(date.getTime() + TimeUnit.DAYS.toMillis(userPreferenceManager.get(UserPreference.General.DefaultReportDuration)))) .subscribe(view.displayEndDate())); } } TripDatesPresenter(@NonNull TripDateView view, @NonNull UserPreferenceManager userPreferenceManager, @Nullable Trip editableTrip); @Override void subscribe(); }
TripDatesPresenter extends BasePresenter<TripDateView> { @Override public void subscribe() { if (editableTrip == null) { compositeDisposable.add(view.getStartDateChanges() .map(date -> new Date(date.getTime() + TimeUnit.DAYS.toMillis(userPreferenceManager.get(UserPreference.General.DefaultReportDuration)))) .subscribe(view.displayEndDate())); } } TripDatesPresenter(@NonNull TripDateView view, @NonNull UserPreferenceManager userPreferenceManager, @Nullable Trip editableTrip); @Override void subscribe();  }