use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableTakeUntilTest method mainErrors.
@Test
public void mainErrors() {
CompletableSubject cs1 = CompletableSubject.create();
CompletableSubject cs2 = CompletableSubject.create();
TestObserver<Void> to = cs1.takeUntil(cs2).test();
to.assertEmpty();
assertTrue(cs1.hasObservers());
assertTrue(cs2.hasObservers());
cs1.onError(new TestException());
assertFalse(cs1.hasObservers());
assertFalse(cs2.hasObservers());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableDelaySubscriptionTest method disposeMain.
@Test
public void disposeMain() {
CompletableSubject cs = CompletableSubject.create();
TestScheduler scheduler = new TestScheduler();
TestObserver<Void> to = cs.delaySubscription(1, TimeUnit.SECONDS, scheduler).test();
assertFalse(cs.hasObservers());
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
assertTrue(cs.hasObservers());
to.dispose();
assertFalse(cs.hasObservers());
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableToFutureTest method cancel2.
@Test
public void cancel2() {
CompletableSubject cs = CompletableSubject.create();
Future<Void> f = cs.toFuture();
assertTrue(cs.hasObservers());
f.cancel(false);
assertFalse(cs.hasObservers());
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableToFutureTest method cancel.
@Test
public void cancel() {
CompletableSubject cs = CompletableSubject.create();
Future<Void> f = cs.toFuture();
assertTrue(cs.hasObservers());
f.cancel(true);
assertFalse(cs.hasObservers());
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableSwitchMapCompletableTest method innerError.
@Test
public void innerError() {
PublishProcessor<Integer> pp = PublishProcessor.create();
CompletableSubject cs = CompletableSubject.create();
TestObserver<Void> to = pp.switchMapCompletable(Functions.justFunction(cs)).test();
assertTrue(pp.hasSubscribers());
assertFalse(cs.hasObservers());
pp.onNext(1);
assertTrue(cs.hasObservers());
to.assertEmpty();
cs.onError(new TestException());
to.assertFailure(TestException.class);
assertFalse(pp.hasSubscribers());
assertFalse(cs.hasObservers());
}
Aggregations