use of io.reactivex.rxjava3.internal.functions.Functions in project RxJava by ReactiveX.
the class FlowableDematerializeTest method eventsAfterDematerializedTerminal.
@Test
public void eventsAfterDematerializedTerminal() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
new Flowable<Notification<Object>>() {
@Override
protected void subscribeActual(Subscriber<? super Notification<Object>> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
subscriber.onNext(Notification.createOnComplete());
subscriber.onNext(Notification.<Object>createOnNext(1));
subscriber.onNext(Notification.createOnError(new TestException("First")));
subscriber.onError(new TestException("Second"));
}
}.dematerialize(Functions.<Notification<Object>>identity()).test().assertResult();
TestHelper.assertUndeliverable(errors, 0, TestException.class, "First");
TestHelper.assertUndeliverable(errors, 1, TestException.class, "Second");
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.internal.functions.Functions in project RxJava by ReactiveX.
the class ObservableWindowWithStartEndObservableTest method startError.
@Test
public void startError() {
PublishSubject<Integer> source = PublishSubject.create();
PublishSubject<Integer> start = PublishSubject.create();
final PublishSubject<Integer> end = PublishSubject.create();
TestObserver<Integer> to = source.window(start, new Function<Integer, ObservableSource<Integer>>() {
@Override
public ObservableSource<Integer> apply(Integer v) throws Exception {
return end;
}
}).flatMap(Functions.<Observable<Integer>>identity()).test();
start.onError(new TestException());
to.assertFailure(TestException.class);
assertFalse("Source has observers!", source.hasObservers());
assertFalse("Start has observers!", start.hasObservers());
assertFalse("End has observers!", end.hasObservers());
}
use of io.reactivex.rxjava3.internal.functions.Functions in project RxJava by ReactiveX.
the class ObservableWindowWithTimeTest method exactOnError.
@Test
@SuppressUndeliverable
public void exactOnError() {
TestScheduler scheduler = new TestScheduler();
PublishSubject<Integer> ps = PublishSubject.create();
TestObserver<Integer> to = ps.window(1, 1, TimeUnit.SECONDS, scheduler).flatMap(Functions.<Observable<Integer>>identity()).test();
ps.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.internal.functions.Functions in project RxJava by ReactiveX.
the class LambdaObserverTest method disposedObserverShouldReportErrorOnGlobalErrorHandler.
@Test
public void disposedObserverShouldReportErrorOnGlobalErrorHandler() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
final List<Throwable> observerErrors = Collections.synchronizedList(new ArrayList<>());
LambdaObserver<Integer> o = new LambdaObserver<>(Functions.<Integer>emptyConsumer(), new Consumer<Throwable>() {
@Override
public void accept(Throwable t) {
observerErrors.add(t);
}
}, Functions.EMPTY_ACTION, Functions.<Disposable>emptyConsumer());
o.dispose();
o.onError(new IOException());
o.onError(new IOException());
assertTrue(observerErrors.isEmpty());
TestHelper.assertUndeliverable(errors, 0, IOException.class);
TestHelper.assertUndeliverable(errors, 1, IOException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.internal.functions.Functions in project RxJava by ReactiveX.
the class ObservableDematerializeTest method honorsContractWhenThrows.
@Test
public void honorsContractWhenThrows() {
Observable<Integer> source = Observable.error(new TestException());
Observable<Integer> result = source.materialize().dematerialize(Functions.<Notification<Integer>>identity());
Observer<Integer> o = TestHelper.mockObserver();
result.subscribe(o);
verify(o, never()).onNext(any(Integer.class));
verify(o, never()).onComplete();
verify(o).onError(any(TestException.class));
}
Aggregations