Java Code Examples for io.reactivex.rxjava3.observers.TestObserver#assertValueSequence()

The following examples show how to use io.reactivex.rxjava3.observers.TestObserver#assertValueSequence() . 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 6 votes vote down vote up
@Test
public void rx_ListPopulationMoreThanOneMillionWithTimeoutFallbackToEmpty_When_NoTimeout() throws InterruptedException {
    FutureTask<List<Country>> futureTask = new FutureTask<>(() -> {
        TimeUnit.MILLISECONDS.sleep(100);
        return allCountries;
    });
    new Thread(futureTask).start();
    TestObserver<Country> testObserver = countriesService
            .listPopulationMoreThanOneMillionWithTimeoutFallbackToEmpty(futureTask)
            .test();
    List<Country> expectedResult = CountriesTestProvider.countriesPopulationMoreThanOneMillion();
    testObserver.await();
    testObserver.assertComplete();
    testObserver.assertValueSequence(expectedResult);
    testObserver.assertNoErrors();
}
 
Example 2
Source File: CountriesServiceSolvedTest.java    From RxBasicsKata with MIT License 5 votes vote down vote up
@Test
public void rx_ListPopulationOfEachCountry() {
    List<Long> expectedResult = CountriesTestProvider.populationOfCountries();
    TestObserver<Long> testObserver = countriesService
            .listPopulationOfEachCountry(allCountries)
            .test();
    testObserver.assertValueSequence(expectedResult);
    testObserver.assertNoErrors();
}
 
Example 3
Source File: CountriesServiceSolvedTest.java    From RxBasicsKata with MIT License 5 votes vote down vote up
@Test
public void rx_ListNameOfEachCountry() {
    List<String> expectedResult = CountriesTestProvider.namesOfCountries();
    TestObserver<String> testObserver = countriesService
            .listNameOfEachCountry(allCountries)
            .test();
    testObserver.assertValueSequence(expectedResult);
    testObserver.assertNoErrors();
}
 
Example 4
Source File: CountriesServiceSolvedTest.java    From RxBasicsKata with MIT License 5 votes vote down vote up
@Test
public void rx_ListOnly3rdAnd4thCountry() {
    List<Country> expectedResult = new ArrayList<>();
    expectedResult.add(allCountries.get(2));
    expectedResult.add(allCountries.get(3));

    TestObserver<Country> testObserver = countriesService
            .listOnly3rdAnd4thCountry(allCountries)
            .test();
    testObserver.assertValueSequence(expectedResult);
    testObserver.assertNoErrors();
}
 
Example 5
Source File: CountriesServiceSolvedTest.java    From RxBasicsKata with MIT License 5 votes vote down vote up
@Test
public void rx_ListPopulationMoreThanOneMillion() {
    List<Country> expectedResult = CountriesTestProvider.countriesPopulationMoreThanOneMillion();
    TestObserver<Country> testObserver = countriesService
            .listPopulationMoreThanOneMillion(allCountries)
            .test();
    testObserver.assertValueSequence(expectedResult);
    testObserver.assertNoErrors();
}