use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableConcatWithCompletableTest method cancelOther.
@Test
public void cancelOther() {
CompletableSubject other = CompletableSubject.create();
TestSubscriber<Object> ts = Flowable.empty().concatWith(other).test();
assertTrue(other.hasObservers());
ts.cancel();
assertFalse(other.hasObservers());
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableAndThenPublisherTest method cancelMain.
@Test
public void cancelMain() {
CompletableSubject cs = CompletableSubject.create();
PublishProcessor<Integer> pp = PublishProcessor.create();
TestSubscriber<Integer> ts = cs.andThen(pp).test();
assertTrue(cs.hasObservers());
assertFalse(pp.hasSubscribers());
ts.cancel();
assertFalse(cs.hasObservers());
assertFalse(pp.hasSubscribers());
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableAndThenPublisherTest method cancelOther.
@Test
public void cancelOther() {
CompletableSubject cs = CompletableSubject.create();
PublishProcessor<Integer> pp = PublishProcessor.create();
TestSubscriber<Integer> ts = cs.andThen(pp).test();
assertTrue(cs.hasObservers());
assertFalse(pp.hasSubscribers());
cs.onComplete();
assertFalse(cs.hasObservers());
assertTrue(pp.hasSubscribers());
ts.cancel();
assertFalse(cs.hasObservers());
assertFalse(pp.hasSubscribers());
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableSwitchMapCompletableTest method dispose.
@Test
public void dispose() {
PublishProcessor<Integer> pp = PublishProcessor.create();
CompletableSubject cs = CompletableSubject.create();
TestObserver<Void> to = pp.switchMapCompletable(Functions.justFunction(cs)).test();
pp.onNext(1);
assertTrue(pp.hasSubscribers());
assertTrue(cs.hasObservers());
to.dispose();
assertFalse(pp.hasSubscribers());
assertFalse(cs.hasObservers());
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableSwitchMapCompletableTest method onNextInnerCompleteRace.
@Test
public void onNextInnerCompleteRace() {
for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) {
final PublishProcessor<Integer> pp = PublishProcessor.create();
final CompletableSubject cs = CompletableSubject.create();
TestObserver<Void> to = pp.switchMapCompletable(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();
}
};
TestHelper.race(r1, r2);
to.assertEmpty();
}
}
Aggregations