use of io.reactivex.rxjava3.observers.SerializedObserver in project RxJava by ReactiveX.
the class SerializedObserverTest method dispose.
@Test
public void dispose() {
TestObserver<Integer> to = new TestObserver<>();
SerializedObserver<Integer> so = new SerializedObserver<>(to);
Disposable d = Disposable.empty();
so.onSubscribe(d);
assertFalse(so.isDisposed());
to.dispose();
assertTrue(so.isDisposed());
assertTrue(d.isDisposed());
}
use of io.reactivex.rxjava3.observers.SerializedObserver in project RxJava by ReactiveX.
the class SerializedObserverTest method onCompleteRace.
@Test
public void onCompleteRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
TestObserver<Integer> to = new TestObserver<>();
final SerializedObserver<Integer> so = new SerializedObserver<>(to);
Disposable d = Disposable.empty();
so.onSubscribe(d);
Runnable r = new Runnable() {
@Override
public void run() {
so.onComplete();
}
};
TestHelper.race(r, r);
to.awaitDone(5, TimeUnit.SECONDS).assertResult();
}
}
Aggregations