use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class ReplayProcessorTest method sizeAndTimeBoundReplayError.
@Test
public void sizeAndTimeBoundReplayError() {
ReplayProcessor<Integer> rp = ReplayProcessor.createWithTimeAndSize(1, TimeUnit.DAYS, Schedulers.single(), 2);
rp.onNext(1);
rp.onNext(2);
rp.onNext(3);
rp.onNext(4);
rp.onError(new TestException());
rp.test().assertFailure(TestException.class, 3, 4);
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class ReplayProcessorTest method sizeboundReplayError.
@Test
public void sizeboundReplayError() {
ReplayProcessor<Integer> rp = ReplayProcessor.createWithSize(2);
rp.onNext(1);
rp.onNext(2);
rp.onNext(3);
rp.onNext(4);
rp.onError(new TestException());
rp.test().assertFailure(TestException.class, 3, 4);
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class SchedulerTest method scheduleDirectThrows.
@Test
public void scheduleDirectThrows() throws Exception {
List<Throwable> list = TestHelper.trackPluginErrors();
try {
Schedulers.io().scheduleDirect(new Runnable() {
@Override
public void run() {
throw new TestException();
}
});
Thread.sleep(250);
assertTrue(list.size() >= 1);
TestHelper.assertUndeliverable(list, 0, TestException.class, null);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class SingleCacheTest method crossCancelOnError.
@Test
public void crossCancelOnError() {
PublishSubject<Integer> ps = PublishSubject.create();
Single<Integer> cache = ps.single(-99).cache();
final TestSubscriber<Integer> ts1 = new TestSubscriber<>();
TestSubscriber<Integer> ts2 = new TestSubscriber<Integer>() {
@Override
public void onError(Throwable t) {
super.onError(t);
ts1.cancel();
}
};
cache.toFlowable().subscribe(ts2);
cache.toFlowable().subscribe(ts1);
ps.onError(new TestException());
ts1.assertNoValues().assertNoErrors().assertNotComplete();
ts2.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class SingleRetryTest method untilFalseError.
@Test
public void untilFalseError() {
AtomicInteger counter = new AtomicInteger();
Single.defer(() -> {
if (counter.getAndIncrement() == 0) {
return Single.error(new TestException());
}
return Single.just(1);
}).retryUntil(() -> false).test().assertResult(1);
}
Aggregations