use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableTimeoutWithSelectorTest method testTimeoutSelectorSubsequentFlowableThrows.
@Test
public void testTimeoutSelectorSubsequentFlowableThrows() {
PublishProcessor<Integer> source = PublishProcessor.create();
final PublishProcessor<Integer> timeout = PublishProcessor.create();
Function<Integer, Flowable<Integer>> timeoutFunc = new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer t1) {
return Flowable.<Integer>error(new TestException());
}
};
Flowable<Integer> other = Flowable.fromIterable(Arrays.asList(100));
Subscriber<Object> o = TestHelper.mockSubscriber();
InOrder inOrder = inOrder(o);
source.timeout(timeout, timeoutFunc, other).subscribe(o);
source.onNext(1);
inOrder.verify(o).onNext(1);
inOrder.verify(o).onError(any(TestException.class));
verify(o, never()).onComplete();
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableTimeoutWithSelectorTest method testTimeoutSelectorSubsequentThrows.
@Test
public void testTimeoutSelectorSubsequentThrows() {
PublishProcessor<Integer> source = PublishProcessor.create();
final PublishProcessor<Integer> timeout = PublishProcessor.create();
Function<Integer, Flowable<Integer>> timeoutFunc = new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer t1) {
throw new TestException();
}
};
Flowable<Integer> other = Flowable.fromIterable(Arrays.asList(100));
Subscriber<Object> o = TestHelper.mockSubscriber();
InOrder inOrder = inOrder(o);
source.timeout(timeout, timeoutFunc, other).subscribe(o);
source.onNext(1);
inOrder.verify(o).onNext(1);
inOrder.verify(o).onError(any(TestException.class));
verify(o, never()).onComplete();
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableSkipLastTimedTest method testSkipLastTimedErrorBeforeTime.
@Test
public void testSkipLastTimedErrorBeforeTime() {
TestScheduler scheduler = new TestScheduler();
PublishProcessor<Integer> source = PublishProcessor.create();
Flowable<Integer> result = source.skipLast(1, TimeUnit.SECONDS, scheduler);
Subscriber<Object> o = TestHelper.mockSubscriber();
result.subscribe(o);
source.onNext(1);
source.onNext(2);
source.onNext(3);
source.onError(new TestException());
scheduler.advanceTimeBy(1050, TimeUnit.MILLISECONDS);
verify(o).onError(any(TestException.class));
verify(o, never()).onComplete();
verify(o, never()).onNext(any());
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableWithLatestFromTest method withMainError.
@Test
public void withMainError() {
TestSubscriber<String> ts = new TestSubscriber<String>(0);
Flowable.error(new TestException()).withLatestFrom(new Flowable<?>[] { Flowable.just(1), Flowable.just(1) }, toArray).subscribe(ts);
ts.assertNoValues();
ts.assertError(TestException.class);
ts.assertNotComplete();
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableZipIterableTest method testZipIterableIteratorThrows.
@Test
public void testZipIterableIteratorThrows() {
PublishProcessor<String> r1 = PublishProcessor.create();
/* define a Subscriber to receive aggregated events */
Subscriber<String> o = TestHelper.mockSubscriber();
InOrder io = inOrder(o);
Iterable<String> r2 = new Iterable<String>() {
@Override
public Iterator<String> iterator() {
throw new TestException();
}
};
r1.zipWith(r2, zipr2).subscribe(o);
r1.onNext("one-");
r1.onNext("two-");
r1.onError(new TestException());
io.verify(o).onError(any(TestException.class));
verify(o, never()).onComplete();
verify(o, never()).onNext(any(String.class));
}
Aggregations