use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class ObservableConcatMapTest method onErrorRace.
@Test
public void onErrorRace() {
for (int i = 0; i < 500; i++) {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final PublishSubject<Integer> ps1 = PublishSubject.create();
final PublishSubject<Integer> ps2 = PublishSubject.create();
TestObserver<Integer> to = ps1.concatMap(new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
return ps2;
}
}).test();
final TestException ex1 = new TestException();
final TestException ex2 = new TestException();
Runnable r1 = new Runnable() {
@Override
public void run() {
ps1.onError(ex1);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
ps2.onError(ex2);
}
};
TestHelper.race(r1, r2, Schedulers.single());
to.assertFailure(TestException.class);
if (!errors.isEmpty()) {
TestHelper.assertError(errors, 0, TestException.class);
}
} finally {
RxJavaPlugins.reset();
}
}
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class NotificationLiteTest method errorNotification.
@Test
public void errorNotification() {
Object o = NotificationLite.error(new TestException());
assertEquals("NotificationLite.Error[io.reactivex.exceptions.TestException]", o.toString());
assertTrue(NotificationLite.isError(o));
assertFalse(NotificationLite.isComplete(o));
assertFalse(NotificationLite.isDisposable(o));
assertFalse(NotificationLite.isSubscription(o));
assertTrue(NotificationLite.getError(o) instanceof TestException);
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class BlockingObservableLatestTest method onError.
@SuppressWarnings("unchecked")
@Test
public void onError() {
Iterator<Object> it = Observable.never().blockingLatest().iterator();
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
((Observer<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 BlockingObservableNextTest method nextObserverError.
@Test
public void nextObserverError() {
NextObserver<Integer> no = new NextObserver<Integer>();
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
no.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 BlockingObservableNextTest method testOnError.
@Test
public void testOnError() throws Throwable {
Subject<String> obs = PublishSubject.create();
Iterator<String> it = next(obs).iterator();
obs.onError(new TestException());
try {
it.hasNext();
fail("Expected an TestException");
} catch (TestException e) {
// successful
}
assertErrorAfterObservableFail(it);
}
Aggregations