use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class FlowableWithLatestFromTest method withMainError.
@Test
public void withMainError() {
TestSubscriber<String> ts = new TestSubscriber<>(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.rxjava3.exceptions.TestException 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.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeCreateTest method onCompleteThrows.
@Test
public void onCompleteThrows() {
Maybe.create(new MaybeOnSubscribe<Object>() {
@Override
public void subscribe(MaybeEmitter<Object> e) throws Exception {
Disposable d = Disposable.empty();
e.setDisposable(d);
try {
e.onComplete();
fail("Should have thrown");
} catch (TestException ex) {
// expected
}
assertTrue(d.isDisposed());
assertTrue(e.isDisposed());
}
}).subscribe(new MaybeObserver<Object>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(Object value) {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
throw new TestException();
}
});
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeDelaySubscriptionTest method withPublisherCallAfterTerminalEvent.
@Test
public void withPublisherCallAfterTerminalEvent() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Flowable<Integer> f = new Flowable<Integer>() {
@Override
protected void subscribeActual(Subscriber<? super Integer> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
subscriber.onNext(1);
subscriber.onError(new TestException());
subscriber.onComplete();
subscriber.onNext(2);
}
};
Maybe.just(1).delaySubscription(f).test().assertResult(1);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeDoAfterSuccessTest method consumerThrows.
@Test
public void consumerThrows() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Maybe.just(1).doAfterSuccess(new Consumer<Integer>() {
@Override
public void accept(Integer e) throws Exception {
throw new TestException();
}
}).test().assertResult(1);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
Aggregations