use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class BlockingFlowableLatestTest method onError.
@SuppressWarnings("unchecked")
@Test
public void onError() {
Iterator<Object> it = Flowable.never().blockingLatest().iterator();
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
((Subscriber<Object>) it).onError(new TestException());
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableDematerializeTest method eventsAfterDematerializedTerminal.
@Test
public void eventsAfterDematerializedTerminal() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
new Flowable<Object>() {
@Override
protected void subscribeActual(Subscriber<? super Object> observer) {
observer.onSubscribe(new BooleanSubscription());
observer.onNext(Notification.createOnComplete());
observer.onNext(Notification.createOnNext(1));
observer.onNext(Notification.createOnError(new TestException("First")));
observer.onError(new TestException("Second"));
}
}.dematerialize().test().assertResult();
TestHelper.assertUndeliverable(errors, 0, TestException.class, "First");
TestHelper.assertUndeliverable(errors, 1, TestException.class, "Second");
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableOnErrorResumeNextViaFlowableTest method normalBackpressure.
@Test
public void normalBackpressure() {
TestSubscriber<Integer> ts = TestSubscriber.create(0);
PublishProcessor<Integer> ps = PublishProcessor.create();
ps.onErrorResumeNext(Flowable.range(3, 2)).subscribe(ts);
ts.request(2);
ps.onNext(1);
ps.onNext(2);
ps.onError(new TestException("Forced failure"));
ts.assertValues(1, 2);
ts.assertNoErrors();
ts.assertNotComplete();
ts.request(2);
ts.assertValues(1, 2, 3, 4);
ts.assertNoErrors();
ts.assertComplete();
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableOnErrorResumeNextViaFunctionTest method normalBackpressure.
@Test
public void normalBackpressure() {
TestSubscriber<Integer> ts = TestSubscriber.create(0);
PublishProcessor<Integer> ps = PublishProcessor.create();
ps.onErrorResumeNext(new Function<Throwable, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Throwable v) {
return Flowable.range(3, 2);
}
}).subscribe(ts);
ts.request(2);
ps.onNext(1);
ps.onNext(2);
ps.onError(new TestException("Forced failure"));
ts.assertValues(1, 2);
ts.assertNoErrors();
ts.assertNotComplete();
ts.request(2);
ts.assertValues(1, 2, 3, 4);
ts.assertNoErrors();
ts.assertComplete();
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableOnErrorReturnTest method normalBackpressure.
@Test
public void normalBackpressure() {
TestSubscriber<Integer> ts = TestSubscriber.create(0);
PublishProcessor<Integer> ps = PublishProcessor.create();
ps.onErrorReturn(new Function<Throwable, Integer>() {
@Override
public Integer apply(Throwable e) {
return 3;
}
}).subscribe(ts);
ts.request(2);
ps.onNext(1);
ps.onNext(2);
ps.onError(new TestException("Forced failure"));
ts.assertValues(1, 2);
ts.assertNoErrors();
ts.assertNotComplete();
ts.request(2);
ts.assertValues(1, 2, 3);
ts.assertNoErrors();
ts.assertComplete();
}
Aggregations