use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeDoAfterSuccessTest method errorConditional.
@Test
public void errorConditional() {
Maybe.<Integer>error(new TestException()).doAfterSuccess(afterSuccess).filter(Functions.alwaysTrue()).subscribeWith(ts).assertFailure(TestException.class);
assertTrue(values.isEmpty());
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeDoFinallyTest method actionThrowsConditional.
@Test
public void actionThrowsConditional() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Maybe.just(1).doFinally(new Action() {
@Override
public void run() throws Exception {
throw new TestException();
}
}).filter(Functions.alwaysTrue()).test().assertResult(1).cancel();
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeMergeArrayTest method errorRace.
@SuppressWarnings("unchecked")
@Test
public void errorRace() {
for (int i = 0; i < 500; i++) {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final PublishSubject<Integer> ps1 = PublishSubject.create();
final PublishSubject<Integer> ps2 = PublishSubject.create();
TestSubscriber<Integer> ts = Maybe.mergeArray(ps1.singleElement(), ps2.singleElement()).test();
final TestException ex = new TestException();
Runnable r1 = new Runnable() {
@Override
public void run() {
ps1.onError(ex);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
ps2.onError(ex);
}
};
TestHelper.race(r1, r2, Schedulers.single());
ts.assertFailure(Throwable.class);
if (!errors.isEmpty()) {
TestHelper.assertUndeliverable(errors, 0, TestException.class);
}
} finally {
RxJavaPlugins.reset();
}
}
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeMergeArrayTest method errorFused.
@SuppressWarnings("unchecked")
@Test
public void errorFused() {
TestSubscriber<Integer> ts = SubscriberFusion.newTest(QueueSubscription.ANY);
Maybe.mergeArray(Maybe.<Integer>error(new TestException()), Maybe.just(2)).subscribe(ts);
ts.assertOf(SubscriberFusion.<Integer>assertFuseable()).assertOf(SubscriberFusion.<Integer>assertFusionMode(QueueSubscription.ASYNC)).assertFailure(TestException.class);
}
use of io.reactivex.exceptions.TestException in project RxJava by ReactiveX.
the class MaybeOfTypeTest method errorNotInstance.
@Test
public void errorNotInstance() {
TestObserver<String> ts = Maybe.<Integer>error(new TestException()).ofType(String.class).test();
// don't make this fluent, target type required!
ts.assertFailure(TestException.class);
}
Aggregations