use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class SingleTakeUntilTest method otherErrorCompletable.
@Test
public void otherErrorCompletable() {
PublishProcessor<Integer> pp = PublishProcessor.create();
PublishProcessor<Integer> source = PublishProcessor.create();
TestObserver<Integer> to = source.single(-99).takeUntil(pp.ignoreElements()).test();
pp.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class SingleTakeUntilTest method untilSingleOtherError.
@Test
public void untilSingleOtherError() {
SingleSubject<Integer> main = SingleSubject.create();
SingleSubject<Integer> other = SingleSubject.create();
TestObserver<Integer> to = main.takeUntil(other).test();
assertTrue("Main no observers?", main.hasObservers());
assertTrue("Other no observers?", other.hasObservers());
other.onError(new TestException());
assertFalse("Main has observers?", main.hasObservers());
assertFalse("Other has observers?", other.hasObservers());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class SingleFromPublisherTest method badSource.
@Test
public void badSource() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Single.fromPublisher(new Flowable<Integer>() {
@Override
protected void subscribeActual(Subscriber<? super Integer> s) {
s.onSubscribe(new BooleanSubscription());
BooleanSubscription s2 = new BooleanSubscription();
s.onSubscribe(s2);
assertTrue(s2.isCancelled());
s.onNext(1);
s.onComplete();
s.onNext(2);
s.onError(new TestException());
s.onComplete();
}
}).test().assertResult(1);
TestHelper.assertError(errors, 0, IllegalStateException.class, "Subscription already set!");
TestHelper.assertUndeliverable(errors, 1, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class SingleOfTypeTest method errorNotInstance.
@Test
public void errorNotInstance() {
TestObserver<String> to = Single.<Integer>error(new TestException()).ofType(String.class).test();
// don't make this fluent, target type required!
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class SingleOfTypeTest method error.
@Test
public void error() {
TestObserver<Number> to = Single.<Integer>error(new TestException()).ofType(Number.class).test();
// don't make this fluent, target type required!
to.assertFailure(TestException.class);
}
Aggregations