use of io.reactivex.rxjava3.operators.ConditionalSubscriber in project RxJava by ReactiveX.
the class ParallelMapTest method conditionalCancelIgnored.
@Test
public void conditionalCancelIgnored() {
Flowable<Integer> f = new Flowable<Integer>() {
@Override
protected void subscribeActual(@NonNull Subscriber<@NonNull ? super @NonNull Integer> s) {
@SuppressWarnings("unchecked") ConditionalSubscriber<Integer> subscriber = (ConditionalSubscriber<Integer>) s;
subscriber.onSubscribe(new BooleanSubscription());
subscriber.tryOnNext(1);
subscriber.tryOnNext(2);
}
};
ParallelFlowable.fromArray(f).map(v -> {
throw new TestException();
}).filter(v -> true).sequential().test().assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.operators.ConditionalSubscriber in project RxJava by ReactiveX.
the class FlowableFilterTest method sourceIgnoresCancelConditional.
@Test
public void sourceIgnoresCancelConditional() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Flowable.fromPublisher(new Publisher<Integer>() {
@Override
public void subscribe(Subscriber<? super Integer> s) {
ConditionalSubscriber<? super Integer> cs = (ConditionalSubscriber<? super Integer>) s;
cs.onSubscribe(new BooleanSubscription());
cs.tryOnNext(1);
cs.tryOnNext(2);
cs.onError(new IOException());
cs.onComplete();
}
}).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer v) throws Exception {
return true;
}
}).filter(new Predicate<Integer>() {
@Override
public boolean test(Integer v) throws Exception {
throw new TestException();
}
}).test().assertFailure(TestException.class);
TestHelper.assertUndeliverable(errors, 0, IOException.class);
} finally {
RxJavaPlugins.reset();
}
}
Aggregations