use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class FutureSingleObserverTest method onErrorCancelRace.
@Test
public void onErrorCancelRace() {
for (int i = 0; i < 500; i++) {
final PublishSubject<Integer> ps = PublishSubject.create();
final Future<?> f = ps.single(-99).toFuture();
final TestException ex = new TestException();
Runnable r1 = new Runnable() {
@Override
public void run() {
f.cancel(true);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
ps.onError(ex);
}
};
TestHelper.race(r1, r2, Schedulers.single());
}
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class CompletableAwaitTest method blockingGetErrorTimeout.
@Test
public void blockingGetErrorTimeout() {
TestException ex = new TestException();
assertSame(ex, Completable.error(ex).blockingGet(1, TimeUnit.SECONDS));
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class CompletableAwaitTest method blockingGetError.
@Test
public void blockingGetError() {
TestException ex = new TestException();
assertSame(ex, Completable.error(ex).blockingGet());
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class TransformerTest method completableTransformerThrows.
@Test
public void completableTransformerThrows() {
try {
Completable.complete().compose(new CompletableTransformer() {
@Override
public Completable apply(Completable v) {
throw new TestException("Forced failure");
}
});
fail("Should have thrown!");
} catch (TestException ex) {
assertEquals("Forced failure", ex.getMessage());
}
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class TransformerTest method observableTransformerThrows.
@Test
public void observableTransformerThrows() {
try {
Observable.just(1).compose(new ObservableTransformer<Integer, Integer>() {
@Override
public Observable<Integer> apply(Observable<Integer> v) {
throw new TestException("Forced failure");
}
});
fail("Should have thrown!");
} catch (TestException ex) {
assertEquals("Forced failure", ex.getMessage());
}
}
Aggregations