Java Code Examples for io.reactivex.observers.DisposableObserver#onNext()
The following examples show how to use
io.reactivex.observers.DisposableObserver#onNext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CurrencyListViewModelTest.java From exchange-rates-mvvm with Apache License 2.0 | 5 votes |
@Test public void thatRequestForCurrenciesPerformedWhenDateRetrieved() { viewModel.onLoad(null); verify(mGetCurrenciesRatesDateMock).run(mDateObserverCaptor.capture()); final DisposableObserver<Optional<Date>> observer = mDateObserverCaptor.getValue(); observer.onNext(Optional.of(new Date(MILLIS_22_01_2016__10_00))); verify(mGetCurrenciesUseCaseMock).run(mCurrenciesObserverCaptor.capture(), mCurrenciesParamCaptor.capture()); }
Example 2
Source File: CurrencyListViewModelTest.java From exchange-rates-mvvm with Apache License 2.0 | 5 votes |
@Test public void thatDayAddedOnNextClick() { viewModel.onLoad(null); verify(mGetCurrenciesRatesDateMock).run(mDateObserverCaptor.capture()); final DisposableObserver<Optional<Date>> observer = mDateObserverCaptor.getValue(); observer.onNext(Optional.of(new Date(MILLIS_22_01_2016__10_00))); verify(mGetCurrenciesUseCaseMock).run(mCurrenciesObserverCaptor.capture(), mCurrenciesParamCaptor.capture()); viewModel.onNextDay(); assertThat(viewModel.getDateText(), is("2016-01-23")); }
Example 3
Source File: CurrencyListViewModelTest.java From exchange-rates-mvvm with Apache License 2.0 | 5 votes |
@Test public void thatDaySubtractedOnPreviousClick() { viewModel.onLoad(null); verify(mGetCurrenciesRatesDateMock).run(mDateObserverCaptor.capture()); final DisposableObserver<Optional<Date>> observer = mDateObserverCaptor.getValue(); observer.onNext(Optional.of(new Date(MILLIS_22_01_2016__10_00))); verify(mGetCurrenciesUseCaseMock).run(mCurrenciesObserverCaptor.capture(), mCurrenciesParamCaptor.capture()); viewModel.onPreviousDay(); assertThat(viewModel.getDateText(), is("2016-01-21")); }
Example 4
Source File: CurrencyListViewModelTest.java From exchange-rates-mvvm with Apache License 2.0 | 5 votes |
@Test public void thatProgressDismissedOnDataRetrieved() { viewModel.onLoad(null); verify(mGetCurrenciesRatesDateMock).run(mDateObserverCaptor.capture()); final DisposableObserver<Optional<Date>> observer = mDateObserverCaptor.getValue(); observer.onNext(Optional.of(new Date(MILLIS_22_01_2016__10_00))); verify(mGetCurrenciesUseCaseMock).run(mCurrenciesObserverCaptor.capture(), mCurrenciesParamCaptor.capture()); final DisposableObserver<CurrencyData> currenciesObserver = mCurrenciesObserverCaptor.getValue(); Assert.assertThat(viewModel.isProgressVisible(), is(true)); currenciesObserver.onNext(new CurrencyData(new Date(), new HashMap<>(), "USD")); Assert.assertThat(viewModel.isProgressVisible(), is(false)); }