use of io.reactivex.rxjava3.processors.PublishProcessor in project RxJava by ReactiveX.
the class FlowableWindowWithStartEndFlowableTest method windowOpenMainCompletes.
@Test
public void windowOpenMainCompletes() {
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.onComplete();
}
w.test();
}).test();
ref1.get().onSubscribe(new BooleanSubscription());
ref1.get().onNext(1);
ts.assertComplete();
}
use of io.reactivex.rxjava3.processors.PublishProcessor 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.processors.PublishProcessor in project RxJava by ReactiveX.
the class FlowableZipIterableTest method zipIterableIteratorThrows.
@Test
public void zipIterableIteratorThrows() {
PublishProcessor<String> r1 = PublishProcessor.create();
/* define a Subscriber to receive aggregated events */
Subscriber<String> subscriber = TestHelper.mockSubscriber();
InOrder io = inOrder(subscriber);
Iterable<String> r2 = new Iterable<String>() {
@Override
public Iterator<String> iterator() {
throw new TestException();
}
};
r1.zipWith(r2, zipr2).subscribe(subscriber);
r1.onNext("one-");
r1.onNext("two-");
r1.onError(new TestException());
io.verify(subscriber).onError(any(TestException.class));
verify(subscriber, never()).onComplete();
verify(subscriber, never()).onNext(any(String.class));
}
use of io.reactivex.rxjava3.processors.PublishProcessor in project RxJava by ReactiveX.
the class SingleTakeUntilTest method mainErrorSingle.
@Test
public void mainErrorSingle() {
PublishProcessor<Integer> pp = PublishProcessor.create();
PublishProcessor<Integer> source = PublishProcessor.create();
TestObserver<Integer> to = source.single(-99).takeUntil(pp.single(-99)).test();
source.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.processors.PublishProcessor in project RxJava by ReactiveX.
the class SingleTakeUntilTest method mainErrorPublisher.
@Test
public void mainErrorPublisher() {
PublishProcessor<Integer> pp = PublishProcessor.create();
PublishProcessor<Integer> source = PublishProcessor.create();
TestObserver<Integer> to = source.single(-99).takeUntil(pp).test();
source.onError(new TestException());
to.assertFailure(TestException.class);
}
Aggregations