Java Code Examples for io.reactivex.Observable.blockingSubscribe()

The following are Jave code examples for showing how to use blockingSubscribe() of the io.reactivex.Observable class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Learning-RxJava   File: Ch10_3.java   View Source Code Vote up 5 votes
@Test
public void testBlockingSubscribe() {
    AtomicInteger hitCount = new AtomicInteger();
    Observable<Long> source = Observable.interval(1,
            TimeUnit.SECONDS)
            .take(5);
    source.blockingSubscribe(i -> hitCount.incrementAndGet());
    assertTrue(hitCount.get() == 5);
}