use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class ObservableCreateTest method basicWithErrorSerialized.
@Test
@SuppressUndeliverable
public void basicWithErrorSerialized() {
final Disposable d = Disposable.empty();
Observable.<Integer>create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
e = e.serialize();
e.setDisposable(d);
e.onNext(1);
e.onNext(2);
e.onNext(3);
e.onError(new TestException());
e.onComplete();
e.onNext(4);
e.onError(new TestException());
}
}).test().assertFailure(TestException.class, 1, 2, 3);
assertTrue(d.isDisposed());
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class ObservableCreateTest method basicWithError.
@Test
@SuppressUndeliverable
public void basicWithError() {
final Disposable d = Disposable.empty();
Observable.<Integer>create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
e.setDisposable(d);
e.onNext(1);
e.onNext(2);
e.onNext(3);
e.onError(new TestException());
e.onComplete();
e.onNext(4);
e.onError(new TestException());
}
}).test().assertFailure(TestException.class, 1, 2, 3);
assertTrue(d.isDisposed());
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class ObservableCreateTest method basic.
@Test
@SuppressUndeliverable
public void basic() {
final Disposable d = Disposable.empty();
Observable.<Integer>create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
e.setDisposable(d);
e.onNext(1);
e.onNext(2);
e.onNext(3);
e.onComplete();
e.onError(new TestException());
e.onNext(4);
e.onError(new TestException());
e.onComplete();
}
}).test().assertResult(1, 2, 3);
assertTrue(d.isDisposed());
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class ComputationSchedulerTests method periodicTaskShouldStopOnError2.
@Test
@SuppressUndeliverable
public void periodicTaskShouldStopOnError2() throws Exception {
AtomicInteger repeatCount = new AtomicInteger();
Schedulers.computation().schedulePeriodicallyDirect(new Runnable() {
@Override
public void run() {
repeatCount.incrementAndGet();
throw new OutOfMemoryError();
}
}, 0, 1, TimeUnit.NANOSECONDS);
Thread.sleep(200);
assertEquals(1, repeatCount.get());
}
use of io.reactivex.rxjava3.testsupport.SuppressUndeliverable in project RxJava by ReactiveX.
the class ComputationSchedulerTests method periodicTaskShouldStopOnError.
@Test
@SuppressUndeliverable
public void periodicTaskShouldStopOnError() throws Exception {
AtomicInteger repeatCount = new AtomicInteger();
Schedulers.computation().schedulePeriodicallyDirect(new Runnable() {
@Override
public void run() {
repeatCount.incrementAndGet();
throw new OutOfMemoryError();
}
}, 0, 1, TimeUnit.MILLISECONDS);
Thread.sleep(200);
assertEquals(1, repeatCount.get());
}
Aggregations