use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableTakeUntilTest method consumerDisposes.
@Test
public void consumerDisposes() {
CompletableSubject cs1 = CompletableSubject.create();
CompletableSubject cs2 = CompletableSubject.create();
TestObserver<Void> to = cs1.takeUntil(cs2).test();
to.assertEmpty();
assertTrue(cs1.hasObservers());
assertTrue(cs2.hasObservers());
to.dispose();
assertFalse(cs1.hasObservers());
assertFalse(cs2.hasObservers());
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableTakeUntilTest method mainCompletes.
@Test
public void mainCompletes() {
CompletableSubject cs1 = CompletableSubject.create();
CompletableSubject cs2 = CompletableSubject.create();
TestObserver<Void> to = cs1.takeUntil(cs2).test();
to.assertEmpty();
assertTrue(cs1.hasObservers());
assertTrue(cs2.hasObservers());
cs1.onComplete();
assertFalse(cs1.hasObservers());
assertFalse(cs2.hasObservers());
to.assertResult();
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableSwitchOnNextTest method noDelaySwitch.
@Test
public void noDelaySwitch() {
PublishProcessor<Completable> pp = PublishProcessor.create();
TestObserver<Void> to = Completable.switchOnNext(pp).test();
assertTrue(pp.hasSubscribers());
to.assertEmpty();
CompletableSubject cs1 = CompletableSubject.create();
CompletableSubject cs2 = CompletableSubject.create();
pp.onNext(cs1);
assertTrue(cs1.hasObservers());
pp.onNext(cs2);
assertFalse(cs1.hasObservers());
assertTrue(cs2.hasObservers());
pp.onComplete();
assertTrue(cs2.hasObservers());
cs2.onComplete();
to.assertResult();
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class ObservableConcatWithCompletableTest method cancelOther.
@Test
public void cancelOther() {
CompletableSubject other = CompletableSubject.create();
TestObserver<Object> to = Observable.empty().concatWith(other).test();
assertTrue(other.hasObservers());
to.dispose();
assertFalse(other.hasObservers());
}
Aggregations