Search in sources :

Example 21 with io.reactivex.rxjava3.functions

use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.

the class BoundedSubscriberTest method cancel.

@Test
public void cancel() {
    BoundedSubscriber<Integer> subscriber = new BoundedSubscriber<>(Functions.<Integer>emptyConsumer(), Functions.<Throwable>emptyConsumer(), Functions.EMPTY_ACTION, Functions.<Subscription>boundedConsumer(128), 128);
    BooleanSubscription bs = new BooleanSubscription();
    subscriber.onSubscribe(bs);
    subscriber.cancel();
    assertTrue(bs.isCancelled());
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) Test(org.junit.Test)

Example 22 with io.reactivex.rxjava3.functions

use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.

the class BoundedSubscriberTest method dispose.

@Test
public void dispose() {
    BoundedSubscriber<Integer> subscriber = new BoundedSubscriber<>(Functions.<Integer>emptyConsumer(), Functions.<Throwable>emptyConsumer(), Functions.EMPTY_ACTION, Functions.<Subscription>boundedConsumer(128), 128);
    BooleanSubscription bs = new BooleanSubscription();
    subscriber.onSubscribe(bs);
    assertFalse(subscriber.isDisposed());
    subscriber.dispose();
    assertTrue(bs.isCancelled());
    assertTrue(subscriber.isDisposed());
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) Test(org.junit.Test)

Example 23 with io.reactivex.rxjava3.functions

use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.

the class FlowableDematerializeTest method errorPassThru.

@Test
public void errorPassThru() {
    Exception exception = new Exception("test");
    Flowable<Notification<Integer>> flowable = Flowable.error(exception);
    Flowable<Integer> dematerialize = flowable.dematerialize(Functions.<Notification<Integer>>identity());
    Subscriber<Integer> subscriber = TestHelper.mockSubscriber();
    dematerialize.subscribe(subscriber);
    verify(subscriber, times(1)).onError(exception);
    verify(subscriber, times(0)).onComplete();
    verify(subscriber, times(0)).onNext(any(Integer.class));
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Example 24 with io.reactivex.rxjava3.functions

use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.

the class FlowableDematerializeTest method honorsContractWhenThrows.

@Test
public void honorsContractWhenThrows() {
    Flowable<Integer> source = Flowable.error(new TestException());
    Flowable<Integer> result = source.materialize().dematerialize(Functions.<Notification<Integer>>identity());
    Subscriber<Integer> subscriber = TestHelper.mockSubscriber();
    result.subscribe(subscriber);
    verify(subscriber, never()).onNext(any(Integer.class));
    verify(subscriber, never()).onComplete();
    verify(subscriber).onError(any(TestException.class));
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) Test(org.junit.Test)

Example 25 with io.reactivex.rxjava3.functions

use of io.reactivex.rxjava3.functions in project RxJava by ReactiveX.

the class FlowableDematerializeTest method dematerialize3.

@Test
public void dematerialize3() {
    Exception exception = new Exception("test");
    Flowable<Integer> flowable = Flowable.error(exception);
    Flowable<Integer> dematerialize = flowable.materialize().dematerialize(Functions.<Notification<Integer>>identity());
    Subscriber<Integer> subscriber = TestHelper.mockSubscriber();
    dematerialize.subscribe(subscriber);
    verify(subscriber, times(1)).onError(exception);
    verify(subscriber, times(0)).onComplete();
    verify(subscriber, times(0)).onNext(any(Integer.class));
}
Also used : 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