use of io.reactivex.rxjava3.core.Observable in project RxJava by ReactiveX.
the class ObservableDebounceTest method badSource.
@Test
public void badSource() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
new Observable<Integer>() {
@Override
protected void subscribeActual(Observer<? super Integer> observer) {
observer.onSubscribe(Disposable.empty());
observer.onComplete();
observer.onNext(1);
observer.onError(new TestException());
observer.onComplete();
}
}.debounce(1, TimeUnit.SECONDS, new TestScheduler()).test().assertResult();
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.core.Observable in project RxJava by ReactiveX.
the class ObservableConcatWithCompletableTest method mainError.
@Test
public void mainError() {
final TestObserver<Integer> to = new TestObserver<>();
Observable.<Integer>error(new TestException()).concatWith(Completable.fromAction(new Action() {
@Override
public void run() throws Exception {
to.onNext(100);
}
})).subscribe(to);
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.core.Observable in project RxJava by ReactiveX.
the class ObservableConcatWithSingleTest method mainError.
@Test
public void mainError() {
final TestObserver<Integer> to = new TestObserver<>();
Observable.<Integer>error(new TestException()).concatWith(Single.just(100)).subscribe(to);
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.core.Observable in project RxJava by ReactiveX.
the class ObservableCreateTest method basicSerialized.
@Test
@SuppressUndeliverable
public void basicSerialized() {
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.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.core.Observable in project RxJava by ReactiveX.
the class ObservableCreateTest method basicWithCancellable.
@Test
@SuppressUndeliverable
public void basicWithCancellable() {
final Disposable d1 = Disposable.empty();
final Disposable d2 = Disposable.empty();
Observable.<Integer>create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
e.setDisposable(d1);
e.setCancellable(new Cancellable() {
@Override
public void cancel() throws Exception {
d2.dispose();
}
});
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(d1.isDisposed());
assertTrue(d2.isDisposed());
}
Aggregations