use of io.reactivex.rxjava3.core.Observer in project RxJava by ReactiveX.
the class ObservableSkipTimedTest method skipTimedErrorBeforeTime.
@Test
public void skipTimedErrorBeforeTime() {
TestScheduler scheduler = new TestScheduler();
PublishSubject<Integer> source = PublishSubject.create();
Observable<Integer> result = source.skip(1, TimeUnit.SECONDS, scheduler);
Observer<Object> o = TestHelper.mockObserver();
result.subscribe(o);
source.onNext(1);
source.onNext(2);
source.onNext(3);
source.onError(new TestException());
scheduler.advanceTimeBy(1, TimeUnit.SECONDS);
InOrder inOrder = inOrder(o);
inOrder.verify(o).onError(any(TestException.class));
inOrder.verifyNoMoreInteractions();
verify(o, never()).onNext(any());
verify(o, never()).onComplete();
}
use of io.reactivex.rxjava3.core.Observer in project RxJava by ReactiveX.
the class ObservableSequenceEqualTest method verifyError.
private void verifyError(Observable<Boolean> observable) {
Observer<Boolean> observer = TestHelper.mockObserver();
observable.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onError(isA(TestException.class));
inOrder.verifyNoMoreInteractions();
}
use of io.reactivex.rxjava3.core.Observer in project RxJava by ReactiveX.
the class ObservableSequenceEqualTest method verifyError.
private void verifyError(Single<Boolean> single) {
SingleObserver<Boolean> observer = TestHelper.mockSingleObserver();
single.subscribe(observer);
InOrder inOrder = inOrder(observer);
inOrder.verify(observer, times(1)).onError(isA(TestException.class));
inOrder.verifyNoMoreInteractions();
}
use of io.reactivex.rxjava3.core.Observer in project RxJava by ReactiveX.
the class ObservableMergeWithSingleTest method onErrorMainOverflow.
@Test
public void onErrorMainOverflow() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final AtomicReference<Observer<?>> observerRef = new AtomicReference<>();
TestObserver<Integer> to = new Observable<Integer>() {
@Override
protected void subscribeActual(Observer<? super Integer> observer) {
observer.onSubscribe(Disposable.empty());
observerRef.set(observer);
}
}.mergeWith(Single.<Integer>error(new IOException())).test();
observerRef.get().onError(new TestException());
to.assertFailure(IOException.class);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.core.Observer in project RxJava by ReactiveX.
the class ObservablePublishTest 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.onNext(1);
observer.onComplete();
observer.onNext(2);
observer.onError(new TestException());
observer.onComplete();
}
}.publish().autoConnect().test().assertResult(1);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
Aggregations