Java Code Examples for io.reactivex.rxjava3.observers.TestObserver#assertResult()
The following examples show how to use
io.reactivex.rxjava3.observers.TestObserver#assertResult() .
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: CountriesServiceSolvedTest.java From RxBasicsKata with MIT License | 5 votes |
@Test public void rx_IsAllCountriesPopulationMoreThanOneMillion_Positive() { TestObserver<Boolean> testObserver = countriesService .isAllCountriesPopulationMoreThanOneMillion(CountriesTestProvider.countriesPopulationMoreThanOneMillion()) .test(); testObserver.assertResult(true); testObserver.assertNoErrors(); }
Example 2
Source File: CountriesServiceSolvedTest.java From RxBasicsKata with MIT License | 5 votes |
@Test public void rx_IsAllCountriesPopulationMoreThanOneMillion_Negative() { TestObserver<Boolean> testObserver = countriesService .isAllCountriesPopulationMoreThanOneMillion(allCountries) .test(); testObserver.assertResult(false); testObserver.assertNoErrors(); }
Example 3
Source File: CountriesServiceSolvedTest.java From RxBasicsKata with MIT License | 5 votes |
@Test public void rx_GetCurrencyUsdIfNotFound_When_CountryFound() { String countryRequested = "Austria"; String expectedCurrencyValue = "EUR"; TestObserver<String> testObserver = countriesService .getCurrencyUsdIfNotFound(countryRequested, allCountries) .test(); testObserver.assertResult(expectedCurrencyValue); testObserver.assertNoErrors(); }
Example 4
Source File: CountriesServiceSolvedTest.java From RxBasicsKata with MIT License | 5 votes |
@Test public void rx_GetCurrencyUsdIfNotFound_When_CountryNotFound() { String countryRequested = "Senegal"; String expectedCurrencyValue = "USD"; TestObserver<String> testObserver = countriesService .getCurrencyUsdIfNotFound(countryRequested, allCountries) .test(); testObserver.assertResult(expectedCurrencyValue); testObserver.assertNoErrors(); }
Example 5
Source File: CountriesServiceSolvedTest.java From RxBasicsKata with MIT License | 5 votes |
@Test public void rx_SumPopulationOfCountries() { // hint: use "reduce" operator TestObserver<Long> testObserver = countriesService .sumPopulationOfCountries(allCountries) .test(); testObserver.assertResult(CountriesTestProvider.sumPopulationOfAllCountries()); testObserver.assertNoErrors(); }
Example 6
Source File: CountriesServiceSolvedTest.java From RxBasicsKata with MIT License | 5 votes |
@Test public void rx_MapCountriesToNamePopulation() { TestObserver<Map<String, Long>> values = countriesService.mapCountriesToNamePopulation(allCountries).test(); Map<String, Long> expected = new HashMap<>(); for (Country country : allCountries) { expected.put(country.name, country.population); } values.assertResult(expected); values.assertNoErrors(); }
Example 7
Source File: CountriesServiceSolvedTest.java From RxBasicsKata with MIT License | 5 votes |
@Test public void rx_sumPopulationOfCountries() { // hint: use "map" operator TestObserver<Long> testObserver = countriesService .sumPopulationOfCountries(Observable.fromIterable(allCountries), Observable.fromIterable(allCountries)) .test(); testObserver.assertResult(CountriesTestProvider.sumPopulationOfAllCountries() + CountriesTestProvider.sumPopulationOfAllCountries()); testObserver.assertNoErrors(); }
Example 8
Source File: CountriesServiceSolvedTest.java From RxBasicsKata with MIT License | 5 votes |
@Test public void rx_areEmittingSameSequences_Positive() { // hint: use "sequenceEqual" operator TestObserver<Boolean> testObserver = countriesService .areEmittingSameSequences(Observable.fromIterable(allCountries), Observable.fromIterable(allCountries)) .test(); testObserver.assertResult(true); testObserver.assertNoErrors(); }
Example 9
Source File: CountriesServiceSolvedTest.java From RxBasicsKata with MIT License | 5 votes |
@Test public void rx_areEmittingSameSequences_Negative() { List<Country> allCountriesDifferentSequence = new ArrayList<>(allCountries); Collections.swap(allCountriesDifferentSequence, 0, 1); TestObserver<Boolean> testObserver = countriesService .areEmittingSameSequences( Observable.fromIterable(allCountries), Observable.fromIterable(allCountriesDifferentSequence)) .test(); testObserver.assertResult(false); testObserver.assertNoErrors(); }