use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class FlowableWindowWithStartEndFlowableTest method closeError.
@Test
public void closeError() throws Throwable {
TestHelper.withErrorTracking(errors -> {
AtomicReference<Subscriber<? super Integer>> ref1 = new AtomicReference<>();
AtomicReference<Subscriber<? super Integer>> ref2 = new AtomicReference<>();
Flowable<Integer> f1 = Flowable.<Integer>unsafeCreate(ref1::set);
Flowable<Integer> f2 = Flowable.<Integer>unsafeCreate(ref2::set);
TestSubscriber<Integer> ts = BehaviorProcessor.createDefault(1).window(f1, v -> f2).flatMap(v -> v).test();
ref1.get().onSubscribe(new BooleanSubscription());
ref1.get().onNext(1);
ref2.get().onSubscribe(new BooleanSubscription());
ref2.get().onError(new TestException());
ref2.get().onError(new TestException());
ts.assertFailure(TestException.class);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
});
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class FlowableWindowWithStartEndFlowableTest method windowOpenMainError.
@Test
public void windowOpenMainError() {
AtomicReference<Subscriber<? super Integer>> ref1 = new AtomicReference<>();
PublishProcessor<Object> pp = PublishProcessor.create();
Flowable<Integer> f1 = Flowable.<Integer>unsafeCreate(ref1::set);
AtomicInteger counter = new AtomicInteger();
TestSubscriber<Flowable<Object>> ts = pp.window(f1, v -> Flowable.never()).doOnNext(w -> {
if (counter.getAndIncrement() == 0) {
ref1.get().onNext(2);
pp.onNext(1);
pp.onError(new TestException());
}
w.test();
}).test();
ref1.get().onSubscribe(new BooleanSubscription());
ref1.get().onNext(1);
ts.assertError(TestException.class);
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class MaybeDelaySubscriptionTest method withPublisherCallAfterTerminalEvent.
@Test
public void withPublisherCallAfterTerminalEvent() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Flowable<Integer> f = new Flowable<Integer>() {
@Override
protected void subscribeActual(Subscriber<? super Integer> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
subscriber.onNext(1);
subscriber.onError(new TestException());
subscriber.onComplete();
subscriber.onNext(2);
}
};
Maybe.just(1).delaySubscription(f).test().assertResult(1);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class SingleFromPublisherTest method badSource.
@Test
public void badSource() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Single.fromPublisher(new Flowable<Integer>() {
@Override
protected void subscribeActual(Subscriber<? super Integer> s) {
s.onSubscribe(new BooleanSubscription());
BooleanSubscription s2 = new BooleanSubscription();
s.onSubscribe(s2);
assertTrue(s2.isCancelled());
s.onNext(1);
s.onComplete();
s.onNext(2);
s.onError(new TestException());
s.onComplete();
}
}).test().assertResult(1);
TestHelper.assertError(errors, 0, IllegalStateException.class, "Subscription already set!");
TestHelper.assertUndeliverable(errors, 1, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class ReplayProcessorTest method subscribeAfterDone.
@Test
public void subscribeAfterDone() {
ReplayProcessor<Integer> rp = ReplayProcessor.create();
rp.onComplete();
BooleanSubscription bs = new BooleanSubscription();
rp.onSubscribe(bs);
assertTrue(bs.isCancelled());
}
Aggregations