use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableSwitchMapCompletableTest method innerErrorDelayed.
@Test
public void innerErrorDelayed() {
final PublishProcessor<Integer> pp = PublishProcessor.create();
final CompletableSubject cs = CompletableSubject.create();
TestObserver<Void> to = pp.switchMapCompletableDelayError(Functions.justFunction(cs)).test();
pp.onNext(1);
cs.onError(new TestException());
to.assertEmpty();
assertTrue(pp.hasSubscribers());
pp.onComplete();
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableSwitchMapCompletableTest method mainCompletesinnerErrorDelayed.
@Test
public void mainCompletesinnerErrorDelayed() {
final PublishProcessor<Integer> pp = PublishProcessor.create();
final CompletableSubject cs = CompletableSubject.create();
TestObserver<Void> to = pp.switchMapCompletableDelayError(Functions.justFunction(cs)).test();
pp.onNext(1);
pp.onComplete();
to.assertEmpty();
cs.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableSwitchMapCompletableTest method checkDisposed.
@Test
public void checkDisposed() {
PublishProcessor<Integer> pp = PublishProcessor.create();
CompletableSubject cs = CompletableSubject.create();
TestHelper.checkDisposed(pp.switchMapCompletable(Functions.justFunction(cs)));
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableConcatMapCompletableTest method immediateError2.
@Test
public void immediateError2() {
PublishProcessor<Integer> pp = PublishProcessor.create();
CompletableSubject cs = CompletableSubject.create();
TestObserver<Void> to = pp.concatMapCompletable(Functions.justFunction(cs)).test();
to.assertEmpty();
assertTrue(pp.hasSubscribers());
assertFalse(cs.hasObservers());
pp.onNext(1);
assertTrue(cs.hasObservers());
cs.onError(new TestException());
assertFalse(pp.hasSubscribers());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableConcatMapCompletableTest method disposeInDrainLoop.
@Test
public void disposeInDrainLoop() {
for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) {
final PublishProcessor<Integer> pp = PublishProcessor.create();
final CompletableSubject cs = CompletableSubject.create();
final TestObserver<Void> to = pp.concatMapCompletable(Functions.justFunction(cs)).test();
pp.onNext(1);
Runnable r1 = new Runnable() {
@Override
public void run() {
pp.onNext(2);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
cs.onComplete();
to.dispose();
}
};
TestHelper.race(r1, r2);
to.assertEmpty();
}
}
Aggregations