use of io.reactivex.rxjava3.observers.TestObserver 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.observers.TestObserver 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.observers.TestObserver 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.observers.TestObserver 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);
}
use of io.reactivex.rxjava3.observers.TestObserver in project RxJava by ReactiveX.
the class SingleZipArrayTest method innerErrorRace.
@Test
public void innerErrorRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final PublishProcessor<Integer> pp0 = PublishProcessor.create();
final PublishProcessor<Integer> pp1 = PublishProcessor.create();
final TestObserver<Object> to = Single.zip(pp0.single(0), pp1.single(0), addString).test();
final TestException ex = new TestException();
Runnable r1 = new Runnable() {
@Override
public void run() {
pp0.onError(ex);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
pp1.onError(ex);
}
};
TestHelper.race(r1, r2);
to.assertFailure(TestException.class);
if (!errors.isEmpty()) {
TestHelper.assertUndeliverable(errors, 0, TestException.class);
}
} finally {
RxJavaPlugins.reset();
}
}
}
Aggregations