use of io.reactivex.rxjava3.processors.PublishProcessor in project RxJava by ReactiveX.
the class FlowableSkipLastTimedTest method skipLastTimedErrorBeforeTime.
@Test
public void skipLastTimedErrorBeforeTime() {
TestScheduler scheduler = new TestScheduler();
PublishProcessor<Integer> source = PublishProcessor.create();
Flowable<Integer> result = source.skipLast(1, TimeUnit.SECONDS, scheduler);
Subscriber<Object> subscriber = TestHelper.mockSubscriber();
result.subscribe(subscriber);
source.onNext(1);
source.onNext(2);
source.onNext(3);
source.onError(new TestException());
scheduler.advanceTimeBy(1050, TimeUnit.MILLISECONDS);
verify(subscriber).onError(any(TestException.class));
verify(subscriber, never()).onComplete();
verify(subscriber, never()).onNext(any());
}
use of io.reactivex.rxjava3.processors.PublishProcessor in project RxJava by ReactiveX.
the class FlowableSkipTimedTest method skipTimedErrorBeforeTime.
@Test
public void skipTimedErrorBeforeTime() {
TestScheduler scheduler = new TestScheduler();
PublishProcessor<Integer> source = PublishProcessor.create();
Flowable<Integer> result = source.skip(1, TimeUnit.SECONDS, scheduler);
Subscriber<Object> subscriber = TestHelper.mockSubscriber();
result.subscribe(subscriber);
source.onNext(1);
source.onNext(2);
source.onNext(3);
source.onError(new TestException());
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
InOrder inOrder = inOrder(subscriber);
inOrder.verify(subscriber).onError(any(TestException.class));
inOrder.verifyNoMoreInteractions();
verify(subscriber, never()).onNext(any());
verify(subscriber, never()).onComplete();
}
use of io.reactivex.rxjava3.processors.PublishProcessor in project RxJava by ReactiveX.
the class FlowableSkipTimedTest method skipTimedFinishBeforeTime.
@Test
public void skipTimedFinishBeforeTime() {
TestScheduler scheduler = new TestScheduler();
PublishProcessor<Integer> source = PublishProcessor.create();
Flowable<Integer> result = source.skip(1, TimeUnit.SECONDS, scheduler);
Subscriber<Object> subscriber = TestHelper.mockSubscriber();
result.subscribe(subscriber);
source.onNext(1);
source.onNext(2);
source.onNext(3);
source.onComplete();
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
InOrder inOrder = inOrder(subscriber);
inOrder.verify(subscriber).onComplete();
inOrder.verifyNoMoreInteractions();
verify(subscriber, never()).onNext(any());
verify(subscriber, never()).onError(any(Throwable.class));
}
use of io.reactivex.rxjava3.processors.PublishProcessor in project RxJava by ReactiveX.
the class FlowableSkipTimedTest method skipTimed.
@Test
public void skipTimed() {
TestScheduler scheduler = new TestScheduler();
PublishProcessor<Integer> source = PublishProcessor.create();
Flowable<Integer> result = source.skip(1, TimeUnit.SECONDS, scheduler);
Subscriber<Object> subscriber = TestHelper.mockSubscriber();
result.subscribe(subscriber);
source.onNext(1);
source.onNext(2);
source.onNext(3);
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
source.onNext(4);
source.onNext(5);
source.onNext(6);
source.onComplete();
InOrder inOrder = inOrder(subscriber);
inOrder.verify(subscriber, never()).onNext(1);
inOrder.verify(subscriber, never()).onNext(2);
inOrder.verify(subscriber, never()).onNext(3);
inOrder.verify(subscriber).onNext(4);
inOrder.verify(subscriber).onNext(5);
inOrder.verify(subscriber).onNext(6);
inOrder.verify(subscriber).onComplete();
inOrder.verifyNoMoreInteractions();
verify(subscriber, never()).onError(any(Throwable.class));
}
use of io.reactivex.rxjava3.processors.PublishProcessor in project RxJava by ReactiveX.
the class ParallelSortedJoinTest method comparatorCrashWhileMainOnError.
@Test
public void comparatorCrashWhileMainOnError() throws Throwable {
TestHelper.withErrorTracking(errors -> {
PublishProcessor<List<Integer>> pp1 = PublishProcessor.create();
PublishProcessor<List<Integer>> pp2 = PublishProcessor.create();
new ParallelSortedJoin<>(ParallelFlowable.fromArray(pp1, pp2), (a, b) -> {
pp1.onError(new IOException());
throw new TestException();
}).test();
pp1.onNext(Arrays.asList(1));
pp2.onNext(Arrays.asList(2));
pp1.onComplete();
pp2.onComplete();
TestHelper.assertUndeliverable(errors, 0, TestException.class);
});
}
Aggregations