use of io.reactivex.rxjava3.observers.DisposableObserver in project RxJava by ReactiveX.
the class ObservableDelayTest method onErrorFinal.
@Test
public void onErrorFinal() {
TestScheduler scheduler = new TestScheduler();
Observable.error(new TestException()).delay(1, TimeUnit.MILLISECONDS, scheduler).subscribe(new DisposableObserver<Object>() {
@Override
public void onNext(Object value) {
}
@Override
public void onError(Throwable e) {
throw new TestException();
}
@Override
public void onComplete() {
}
});
try {
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
fail("Should have thrown");
} catch (TestException ex) {
// expected
}
}
use of io.reactivex.rxjava3.observers.DisposableObserver in project RxJava by ReactiveX.
the class ObservableDelayTest method onCompleteFinal.
@Test
public void onCompleteFinal() {
TestScheduler scheduler = new TestScheduler();
Observable.empty().delay(1, TimeUnit.MILLISECONDS, scheduler).subscribe(new DisposableObserver<Object>() {
@Override
public void onNext(Object value) {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
throw new TestException();
}
});
try {
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
fail("Should have thrown");
} catch (TestException ex) {
// expected
}
}
Aggregations