use of io.reactivex.rxjava3.internal.functions.Functions in project RxJava by ReactiveX.
the class TestObserverTest method assertErrorMultiple.
@Test
public void assertErrorMultiple() {
TestObserver<Integer> to = new TestObserver<>();
TestException e = new TestException();
to.onError(e);
to.onError(new TestException());
try {
to.assertError(TestException.class);
throw new RuntimeException("Should have thrown!");
} catch (AssertionError ex) {
// expected
}
try {
to.assertError(e);
throw new RuntimeException("Should have thrown!");
} catch (AssertionError ex) {
// expected
}
try {
to.assertError(Functions.<Throwable>alwaysTrue());
throw new RuntimeException("Should have thrown!");
} catch (AssertionError ex) {
// expected
}
}
use of io.reactivex.rxjava3.internal.functions.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());
}
use of io.reactivex.rxjava3.internal.functions.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());
}
use of io.reactivex.rxjava3.internal.functions.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));
}
use of io.reactivex.rxjava3.internal.functions.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));
}
Aggregations