use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.
the class AtomicThrowableTest method tryTerminateAndReportHasError.
@Test
public void tryTerminateAndReportHasError() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
AtomicThrowable ex = new AtomicThrowable();
ex.set(new TestException());
ex.tryTerminateAndReport();
TestHelper.assertUndeliverable(errors, 0, TestException.class);
assertEquals(1, errors.size());
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.
the class AtomicThrowableTest method tryAddThrowableOrReportNull.
@Test
public void tryAddThrowableOrReportNull() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
AtomicThrowable ex = new AtomicThrowable();
ex.tryAddThrowableOrReport(new TestException());
assertTrue("" + errors, errors.isEmpty());
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.
the class AtomicThrowableTest method tryTerminateConsumerSubscriberTerminated.
@Test
public void tryTerminateConsumerSubscriberTerminated() {
TestSubscriber<Object> ts = new TestSubscriber<>();
ts.onSubscribe(new BooleanSubscription());
AtomicThrowable ex = new AtomicThrowable();
ex.terminate();
ex.tryTerminateConsumer(ts);
ts.assertEmpty();
}
use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.
the class AtomicThrowableTest method tryTerminateConsumerSubscriberNoError.
@Test
public void tryTerminateConsumerSubscriberNoError() {
TestSubscriber<Object> ts = new TestSubscriber<>();
ts.onSubscribe(new BooleanSubscription());
AtomicThrowable ex = new AtomicThrowable();
ex.tryTerminateConsumer(ts);
ts.assertResult();
}
use of io.reactivex.rxjava3.internal.util.AtomicThrowable in project RxJava by ReactiveX.
the class HalfSerializerSubscriberTest method reentrantOnNextOnError.
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void reentrantOnNextOnError() {
final AtomicInteger wip = new AtomicInteger();
final AtomicThrowable error = new AtomicThrowable();
final Subscriber[] a = { null };
final TestSubscriber ts = new TestSubscriber();
FlowableSubscriber s = new FlowableSubscriber() {
@Override
public void onSubscribe(Subscription s) {
ts.onSubscribe(s);
}
@Override
public void onNext(Object t) {
if (t.equals(1)) {
HalfSerializer.onError(a[0], new TestException(), wip, error);
}
ts.onNext(t);
}
@Override
public void onError(Throwable t) {
ts.onError(t);
}
@Override
public void onComplete() {
ts.onComplete();
}
};
a[0] = s;
s.onSubscribe(new BooleanSubscription());
HalfSerializer.onNext(s, 1, wip, error);
ts.assertFailure(TestException.class, 1);
}
Aggregations