use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.
the class ObservableWindowWithTimeTest method overlappingOnError.
@Test
@SuppressUndeliverable
public void overlappingOnError() {
TestScheduler scheduler = new TestScheduler();
PublishSubject<Integer> ps = PublishSubject.create();
TestObserver<Integer> to = ps.window(2, 1, TimeUnit.SECONDS, scheduler).flatMap(Functions.<Observable<Integer>>identity()).test();
ps.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.
the class ObservableWindowWithTimeTest method skipOnError.
@Test
@SuppressUndeliverable
public void skipOnError() {
TestScheduler scheduler = new TestScheduler();
PublishSubject<Integer> ps = PublishSubject.create();
TestObserver<Integer> to = ps.window(1, 2, TimeUnit.SECONDS, scheduler).flatMap(Functions.<Observable<Integer>>identity()).test();
ps.onError(new TestException());
to.assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.
the class ObservableWindowWithStartEndObservableTest method endError.
@Test
@SuppressUndeliverable
public void endError() {
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.onNext(1);
end.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.functions in project RxJava by ReactiveX.
the class ParallelSortedJoinTest method error2.
@Test
public void error2() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
ParallelFlowable.fromArray(Flowable.<Integer>error(new IOException()), Flowable.<Integer>error(new TestException())).sorted(Functions.<Integer>naturalComparator()).test().assertFailure(IOException.class);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.rxjava3.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();
}
}
Aggregations