use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class SafeSubscriberTest method onNextAfterComplete.
@Test
@SuppressUndeliverable
public void onNextAfterComplete() {
TestSubscriber<Integer> ts = new TestSubscriber<>();
SafeSubscriber<Integer> so = new SafeSubscriber<>(ts);
BooleanSubscription bs = new BooleanSubscription();
so.onSubscribe(bs);
so.onComplete();
so.onNext(1);
so.onError(new TestException());
so.onComplete();
ts.assertResult();
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class NewThreadSchedulerTest method shutdownRejects.
@Test
@SuppressUndeliverable
public void shutdownRejects() {
final int[] calls = { 0 };
Runnable r = new Runnable() {
@Override
public void run() {
calls[0]++;
}
};
Scheduler s = getScheduler();
Worker w = s.createWorker();
w.dispose();
assertTrue(w.isDisposed());
assertEquals(Disposable.disposed(), w.schedule(r));
assertEquals(Disposable.disposed(), w.schedule(r, 1, TimeUnit.SECONDS));
assertEquals(Disposable.disposed(), w.schedulePeriodically(r, 1, 1, TimeUnit.SECONDS));
NewThreadWorker actual = (NewThreadWorker) w;
CompositeDisposable cd = new CompositeDisposable();
actual.scheduleActual(r, 1, TimeUnit.SECONDS, cd);
assertEquals(0, cd.size());
assertEquals(0, calls[0]);
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class AsyncSubjectTest method onErrorCancelRace.
@Test
@SuppressUndeliverable
public void onErrorCancelRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
final AsyncSubject<Object> p = AsyncSubject.create();
final TestObserverEx<Object> to1 = p.to(TestHelper.testConsumer());
Runnable r1 = new Runnable() {
@Override
public void run() {
to1.dispose();
}
};
final TestException ex = new TestException();
Runnable r2 = new Runnable() {
@Override
public void run() {
p.onError(ex);
}
};
TestHelper.race(r1, r2);
if (to1.errors().size() != 0) {
to1.assertFailure(TestException.class);
} else {
to1.assertEmpty();
}
}
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class PublishSubjectTest method crossCancelOnError.
@Test
@SuppressUndeliverable
public void crossCancelOnError() {
final TestObserver<Integer> to1 = new TestObserver<>();
TestObserver<Integer> to2 = new TestObserver<Integer>() {
@Override
public void onError(Throwable t) {
super.onError(t);
to1.dispose();
}
};
PublishSubject<Integer> ps = PublishSubject.create();
ps.subscribe(to2);
ps.subscribe(to1);
ps.onError(new TestException());
to2.assertError(TestException.class);
to1.assertNoErrors();
}
Aggregations