use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class DeferredScalarObserverTest method fusedError.
@Test
public void fusedError() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
TestObserverEx<Integer> to = new TestObserverEx<>(QueueFuseable.ANY);
TakeLast source = new TakeLast(to);
Disposable d = Disposable.empty();
source.onSubscribe(d);
source.onNext(1);
source.onError(new TestException());
source.onError(new TestException("second"));
source.onComplete();
to.assertFailure(TestException.class);
TestHelper.assertUndeliverable(errors, 0, TestException.class, "second");
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class DeferredScalarObserverTest method fused.
@Test
public void fused() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
TestObserverEx<Integer> to = new TestObserverEx<>(QueueFuseable.ANY);
TakeFirst source = new TakeFirst(to);
Disposable d = Disposable.empty();
source.onSubscribe(d);
to.assertFuseable();
to.assertFusionMode(QueueFuseable.ASYNC);
source.onNext(1);
source.onNext(1);
source.onError(new TestException());
source.onComplete();
assertTrue(d.isDisposed());
to.assertResult(1);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class DeferredScalarObserverTest method fusedReject.
@Test
public void fusedReject() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
TestObserverEx<Integer> to = new TestObserverEx<>(QueueFuseable.SYNC);
TakeFirst source = new TakeFirst(to);
Disposable d = Disposable.empty();
source.onSubscribe(d);
to.assertFuseable();
to.assertFusionMode(QueueFuseable.NONE);
source.onNext(1);
source.onNext(1);
source.onError(new TestException());
source.onComplete();
assertTrue(d.isDisposed());
to.assertResult(1);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeFlattenStreamAsObservableTest method nextThrowsInDrain.
@Test
public void nextThrowsInDrain() {
@SuppressWarnings("unchecked") Stream<Integer> stream = mock(Stream.class);
when(stream.iterator()).thenReturn(new Iterator<Integer>() {
@Override
public boolean hasNext() {
return true;
}
@Override
public Integer next() {
throw new TestException();
}
});
Maybe.just(1).flattenStreamAsObservable(v -> stream).test().assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeFlattenStreamAsObservableTest method streamCloseCrash.
@Test
public void streamCloseCrash() throws Throwable {
TestHelper.withErrorTracking(errors -> {
Maybe.just(1).flattenStreamAsObservable(v -> Stream.of(v).onClose(() -> {
throw new TestException();
})).test().assertResult(1);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
});
}
Aggregations