Search in sources :

Example 1 with ObserveOnObserver

use of io.reactivex.internal.operators.observable.ObservableObserveOn.ObserveOnObserver in project RxJava by ReactiveX.

the class ObservableObserveOnTest method nonFusedPollThrows.

@Test
public void nonFusedPollThrows() {
    new Observable<Integer>() {

        @Override
        protected void subscribeActual(Observer<? super Integer> observer) {
            observer.onSubscribe(Disposables.empty());
            @SuppressWarnings("unchecked") ObserveOnObserver<Integer> oo = (ObserveOnObserver<Integer>) observer;
            oo.queue = new SimpleQueue<Integer>() {

                @Override
                public boolean offer(Integer value) {
                    return false;
                }

                @Override
                public boolean offer(Integer v1, Integer v2) {
                    return false;
                }

                @Nullable
                @Override
                public Integer poll() throws Exception {
                    throw new TestException();
                }

                @Override
                public boolean isEmpty() {
                    return false;
                }

                @Override
                public void clear() {
                }
            };
            oo.clear();
            oo.schedule();
        }
    }.observeOn(Schedulers.single()).test().awaitDone(5, TimeUnit.SECONDS).assertFailure(TestException.class);
}
Also used : TestException(io.reactivex.exceptions.TestException) ObserveOnObserver(io.reactivex.internal.operators.observable.ObservableObserveOn.ObserveOnObserver) Observer(io.reactivex.Observer) ObserveOnObserver(io.reactivex.internal.operators.observable.ObservableObserveOn.ObserveOnObserver) Observable(io.reactivex.Observable) Nullable(io.reactivex.annotations.Nullable) TestException(io.reactivex.exceptions.TestException) Test(org.junit.Test)

Aggregations

Observable (io.reactivex.Observable)1 Observer (io.reactivex.Observer)1 Nullable (io.reactivex.annotations.Nullable)1 TestException (io.reactivex.exceptions.TestException)1 ObserveOnObserver (io.reactivex.internal.operators.observable.ObservableObserveOn.ObserveOnObserver)1 Test (org.junit.Test)1