use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableConcatMapCompletableTest method doneButNotEmpty.
@Test
public void doneButNotEmpty() {
final PublishProcessor<Integer> pp = PublishProcessor.create();
final CompletableSubject cs = CompletableSubject.create();
final TestObserver<Void> to = pp.concatMapCompletable(Functions.justFunction(cs)).test();
pp.onNext(1);
pp.onNext(2);
pp.onComplete();
cs.onComplete();
to.assertResult();
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class SingleTakeUntilTest method untilCompletableMainError.
@Test
public void untilCompletableMainError() {
SingleSubject<Integer> main = SingleSubject.create();
CompletableSubject other = CompletableSubject.create();
TestObserver<Integer> to = main.takeUntil(other).test();
assertTrue("Main no observers?", main.hasObservers());
assertTrue("Other no observers?", other.hasObservers());
main.onError(new TestException());
assertFalse("Main has observers?", main.hasObservers());
assertFalse("Other has observers?", other.hasObservers());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class SingleTakeUntilTest method untilCompletableOtherError.
@Test
public void untilCompletableOtherError() {
SingleSubject<Integer> main = SingleSubject.create();
CompletableSubject other = CompletableSubject.create();
TestObserver<Integer> to = main.takeUntil(other).test();
assertTrue("Main no observers?", main.hasObservers());
assertTrue("Other no observers?", other.hasObservers());
other.onError(new TestException());
assertFalse("Main has observers?", main.hasObservers());
assertFalse("Other has observers?", other.hasObservers());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class CompletableToCompletionStageTest method completableFutureCancels.
@Test
public void completableFutureCancels() throws Exception {
CompletableSubject source = CompletableSubject.create();
CompletableFuture<Object> cf = source.toCompletionStage(null).toCompletableFuture();
assertTrue(source.hasObservers());
cf.cancel(true);
assertTrue(cf.isCancelled());
assertFalse(source.hasObservers());
}
use of io.reactivex.rxjava3.subjects.CompletableSubject in project RxJava by ReactiveX.
the class FlowableMergeWithCompletableTest method completeRace.
@Test
public void completeRace() {
for (int i = 0; i < 1000; i++) {
final PublishProcessor<Integer> pp = PublishProcessor.create();
final CompletableSubject cs = CompletableSubject.create();
TestSubscriber<Integer> ts = pp.mergeWith(cs).test();
Runnable r1 = new Runnable() {
@Override
public void run() {
pp.onNext(1);
pp.onComplete();
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
cs.onComplete();
}
};
TestHelper.race(r1, r2);
ts.assertResult(1);
}
}
Aggregations