Search in sources :

Example 26 with io.reactivex.rxjava3.functions

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);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Observable(io.reactivex.rxjava3.core.Observable)

Example 27 with io.reactivex.rxjava3.functions

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);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Observable(io.reactivex.rxjava3.core.Observable)

Example 28 with io.reactivex.rxjava3.functions

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());
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) TestException(io.reactivex.rxjava3.exceptions.TestException) IOException(java.io.IOException) Observable(io.reactivex.rxjava3.core.Observable)

Example 29 with io.reactivex.rxjava3.functions

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();
    }
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) IOException(java.io.IOException) Test(org.junit.Test)

Example 30 with io.reactivex.rxjava3.functions

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();
    }
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)30 TestException (io.reactivex.rxjava3.exceptions.TestException)24 RxMethod (io.reactivex.rxjava3.validators.BaseTypeParser.RxMethod)6 IOException (java.io.IOException)6 Observable (io.reactivex.rxjava3.core.Observable)5 RxJavaTest (io.reactivex.rxjava3.core.RxJavaTest)5 BooleanSubscription (io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription)4 Maps (com.google.common.collect.Maps)2 String.format (java.lang.String.format)2 ByteBuffer (java.nio.ByteBuffer)2 CharacterCodingException (java.nio.charset.CharacterCodingException)2 java.util (java.util)2 TimeUnit (java.util.concurrent.TimeUnit)2 Pattern (java.util.regex.Pattern)2 Collectors (java.util.stream.Collectors)2 Collectors.toList (java.util.stream.Collectors.toList)2 Collectors.toSet (java.util.stream.Collectors.toSet)2 org.apache.cassandra.config (org.apache.cassandra.config)2 org.apache.cassandra.cql3 (org.apache.cassandra.cql3)2 QueryProcessor.executeInternal (org.apache.cassandra.cql3.QueryProcessor.executeInternal)2