use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class FutureSubscriberTest method cancelOnError.
@Test
@SuppressUndeliverable
public void cancelOnError() throws Exception {
fs.cancel(true);
fs.onError(new TestException("One"));
try {
fs.get(5, TimeUnit.MILLISECONDS);
fail("Should have thrown");
} catch (CancellationException ex) {
// expected
}
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class SingleSchedulerTest method shutdownRejects.
@Test
@SuppressUndeliverable
public void shutdownRejects() {
final int[] calls = { 0 };
Runnable r = new Runnable() {
@Override
public void run() {
calls[0]++;
}
};
Scheduler s = new SingleScheduler();
s.shutdown();
assertEquals(Disposable.disposed(), s.scheduleDirect(r));
assertEquals(Disposable.disposed(), s.scheduleDirect(r, 1, TimeUnit.SECONDS));
assertEquals(Disposable.disposed(), s.schedulePeriodicallyDirect(r, 1, 1, TimeUnit.SECONDS));
Worker w = s.createWorker();
((ScheduledWorker) w).executor.shutdownNow();
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));
assertEquals(0, calls[0]);
w.dispose();
assertTrue(w.isDisposed());
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class HalfSerializerObserverTest method onErrorOnCompleteRace.
@Test
@SuppressUndeliverable
public void onErrorOnCompleteRace() {
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
final AtomicInteger wip = new AtomicInteger();
final AtomicThrowable error = new AtomicThrowable();
final TestObserverEx<Integer> to = new TestObserverEx<>();
to.onSubscribe(Disposable.empty());
final TestException ex = new TestException();
Runnable r1 = new Runnable() {
@Override
public void run() {
HalfSerializer.onError(to, ex, wip, error);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
HalfSerializer.onComplete(to, wip, error);
}
};
TestHelper.race(r1, r2);
if (to.completions() != 0) {
to.assertResult();
} else {
to.assertFailure(TestException.class);
}
}
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class SerializedObserverTest method onErrorQueuedUp.
@Test
@SuppressUndeliverable
public void onErrorQueuedUp() {
AtomicReference<SerializedObserver<Integer>> soRef = new AtomicReference<>();
TestObserverEx<Integer> to = new TestObserverEx<Integer>() {
@Override
public void onNext(Integer t) {
super.onNext(t);
soRef.get().onNext(2);
soRef.get().onError(new TestException());
}
};
final SerializedObserver<Integer> so = new SerializedObserver<>(to, true);
soRef.set(so);
Disposable d = Disposable.empty();
so.onSubscribe(d);
so.onNext(1);
to.assertFailure(TestException.class, 1, 2);
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class ObservableTimeoutWithSelectorTest method badSourceTimeout.
@Test
@SuppressUndeliverable
public void badSourceTimeout() {
new Observable<Integer>() {
@Override
protected void subscribeActual(Observer<? super Integer> observer) {
observer.onSubscribe(Disposable.empty());
observer.onNext(1);
observer.onNext(2);
observer.onError(new TestException("First"));
observer.onNext(3);
observer.onComplete();
observer.onError(new TestException("Second"));
}
}.timeout(Functions.justFunction(Observable.never()), Observable.<Integer>never()).take(1).test().assertResult(1);
}
Aggregations