use of io.reactivex.rxjava3.observers.DisposableCompletableObserver in project RxJava by ReactiveX.
the class FlowableIgnoreElementsTest method doesNotHangAndProcessesAllUsingBackpressure.
@Test
public void doesNotHangAndProcessesAllUsingBackpressure() {
final AtomicInteger upstreamCount = new AtomicInteger();
final AtomicInteger count = new AtomicInteger(0);
int num = 10;
Flowable.range(1, num).doOnNext(new Consumer<Integer>() {
@Override
public void accept(Integer t) {
upstreamCount.incrementAndGet();
}
}).ignoreElements().subscribe(new DisposableCompletableObserver() {
@Override
public void onComplete() {
}
@Override
public void onError(Throwable e) {
}
});
assertEquals(num, upstreamCount.get());
assertEquals(0, count.get());
}
use of io.reactivex.rxjava3.observers.DisposableCompletableObserver in project RxJava by ReactiveX.
the class SchedulerWhenTest method onCompleteActionRunCrash.
@Test
public void onCompleteActionRunCrash() {
final AtomicInteger count = new AtomicInteger();
OnCompletedAction a = new OnCompletedAction(new Runnable() {
@Override
public void run() {
throw new TestException();
}
}, new DisposableCompletableObserver() {
@Override
public void onComplete() {
count.incrementAndGet();
}
@Override
public void onError(Throwable e) {
count.decrementAndGet();
e.printStackTrace();
}
});
try {
a.run();
fail("Should have thrown");
} catch (TestException expected) {
}
assertEquals(1, count.get());
}
Aggregations