Search in sources :

Example 11 with AtomicThrowable

use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.

the class AtomicThrowableTest method tryTerminateConsumerCompletableObserverError.

@Test
public void tryTerminateConsumerCompletableObserverError() {
    TestObserver<Object> to = new TestObserver<>();
    to.onSubscribe(Disposable.empty());
    AtomicThrowable ex = new AtomicThrowable();
    ex.set(new TestException());
    ex.tryTerminateConsumer((CompletableObserver) to);
    to.assertFailure(TestException.class);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) TestObserver(io.reactivex.rxjava3.observers.TestObserver) Test(org.junit.Test)

Example 12 with AtomicThrowable

use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.

the class AtomicThrowableTest method tryTerminateConsumerSubscriberError.

@Test
public void tryTerminateConsumerSubscriberError() {
    TestSubscriber<Object> ts = new TestSubscriber<>();
    ts.onSubscribe(new BooleanSubscription());
    AtomicThrowable ex = new AtomicThrowable();
    ex.set(new TestException());
    ex.tryTerminateConsumer(ts);
    ts.assertFailure(TestException.class);
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) TestException(io.reactivex.rxjava3.exceptions.TestException) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) Test(org.junit.Test)

Example 13 with AtomicThrowable

use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.

the class AtomicThrowableTest method tryTerminateConsumerSingleError.

@Test
public void tryTerminateConsumerSingleError() {
    TestObserver<Object> to = new TestObserver<>();
    to.onSubscribe(Disposable.empty());
    AtomicThrowable ex = new AtomicThrowable();
    ex.set(new TestException());
    ex.tryTerminateConsumer((SingleObserver<Object>) to);
    to.assertFailure(TestException.class);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) TestObserver(io.reactivex.rxjava3.observers.TestObserver) Test(org.junit.Test)

Example 14 with AtomicThrowable

use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.

the class AtomicThrowableTest method tryTerminateConsumerMaybeObserverError.

@Test
public void tryTerminateConsumerMaybeObserverError() {
    TestObserver<Object> to = new TestObserver<>();
    to.onSubscribe(Disposable.empty());
    AtomicThrowable ex = new AtomicThrowable();
    ex.set(new TestException());
    ex.tryTerminateConsumer((MaybeObserver<Object>) to);
    to.assertFailure(TestException.class);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) TestObserver(io.reactivex.rxjava3.observers.TestObserver) Test(org.junit.Test)

Example 15 with AtomicThrowable

use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.

the class AtomicThrowableTest method tryTerminateConsumerObserverError.

@Test
public void tryTerminateConsumerObserverError() {
    TestObserver<Object> to = new TestObserver<>();
    to.onSubscribe(Disposable.empty());
    AtomicThrowable ex = new AtomicThrowable();
    ex.set(new TestException());
    ex.tryTerminateConsumer((Observer<Object>) to);
    to.assertFailure(TestException.class);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) TestObserver(io.reactivex.rxjava3.observers.TestObserver) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)22 TestException (io.reactivex.rxjava3.exceptions.TestException)14 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)14 TestObserver (io.reactivex.rxjava3.observers.TestObserver)10 BooleanSubscription (io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription)9 TestSubscriber (io.reactivex.rxjava3.subscribers.TestSubscriber)8 AtomicThrowable (io.reactivex.rxjava3.internal.util.AtomicThrowable)2 IOException (java.io.IOException)2 CompositeDisposable (io.reactivex.rxjava3.disposables.CompositeDisposable)1