use of io.reactivex.rxjava3.functions.Action in project RxJava by ReactiveX.
the class FlowableConcatWithMaybeTest method normalEmpty.
@Test
public void normalEmpty() {
final TestSubscriber<Integer> ts = new TestSubscriber<>();
Flowable.range(1, 5).concatWith(Maybe.<Integer>fromAction(new Action() {
@Override
public void run() throws Exception {
ts.onNext(100);
}
})).subscribe(ts);
ts.assertResult(1, 2, 3, 4, 5, 100);
}
use of io.reactivex.rxjava3.functions.Action in project RxJava by ReactiveX.
the class FlowableConcatWithMaybeTest method mainError.
@Test
public void mainError() {
final TestSubscriber<Integer> ts = new TestSubscriber<>();
Flowable.<Integer>error(new TestException()).concatWith(Maybe.<Integer>fromAction(new Action() {
@Override
public void run() throws Exception {
ts.onNext(100);
}
})).subscribe(ts);
ts.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.functions.Action in project RxJava by ReactiveX.
the class FlowableDoOnEachTest method onErrorAfterCrash.
@Test
public void onErrorAfterCrash() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Flowable.fromPublisher(new Publisher<Object>() {
@Override
public void subscribe(Subscriber<? super Object> s) {
s.onSubscribe(new BooleanSubscription());
s.onError(new TestException());
}
}).doAfterTerminate(new Action() {
@Override
public void run() throws Exception {
throw new IOException();
}
}).test().assertFailure(TestException.class);
TestHelper.assertUndeliverable(errors, 0, IOException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.functions.Action in project RxJava by ReactiveX.
the class FlowableDoOnEachTest method onCompleteAfterCrash.
@Test
public void onCompleteAfterCrash() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Flowable.fromPublisher(new Publisher<Object>() {
@Override
public void subscribe(Subscriber<? super Object> s) {
s.onSubscribe(new BooleanSubscription());
s.onComplete();
}
}).doAfterTerminate(new Action() {
@Override
public void run() throws Exception {
throw new IOException();
}
}).test().assertResult();
TestHelper.assertUndeliverable(errors, 0, IOException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.functions.Action in project RxJava by ReactiveX.
the class FlowableDoOnEachTest method onCompleteCrash.
@Test
public void onCompleteCrash() {
Flowable.fromPublisher(new Publisher<Object>() {
@Override
public void subscribe(Subscriber<? super Object> s) {
s.onSubscribe(new BooleanSubscription());
s.onComplete();
}
}).doOnComplete(new Action() {
@Override
public void run() throws Exception {
throw new IOException();
}
}).test().assertFailure(IOException.class);
}
Aggregations