Search in sources :

Example 1 with FlattenIterableSubscriber

use of io.reactivex.rxjava3.internal.operators.flowable.FlowableFlattenIterable.FlattenIterableSubscriber in project RxJava by ReactiveX.

the class FlowableFlattenIterableTest method fusionRequestedState.

@Test
public void fusionRequestedState() throws Exception {
    TestSubscriber<Integer> ts = new TestSubscriber<>(0);
    FlattenIterableSubscriber<Integer, Integer> f = new FlattenIterableSubscriber<>(ts, Functions.justFunction(Arrays.<Integer>asList(1, 2)), 128);
    f.onSubscribe(new BooleanSubscription());
    f.fusionMode = QueueFuseable.NONE;
    assertEquals(QueueFuseable.NONE, f.requestFusion(QueueFuseable.SYNC));
    assertEquals(QueueFuseable.NONE, f.requestFusion(QueueFuseable.ASYNC));
    f.fusionMode = QueueFuseable.SYNC;
    assertEquals(QueueFuseable.SYNC, f.requestFusion(QueueFuseable.SYNC));
    assertEquals(QueueFuseable.NONE, f.requestFusion(QueueFuseable.ASYNC));
}
Also used : FlattenIterableSubscriber(io.reactivex.rxjava3.internal.operators.flowable.FlowableFlattenIterable.FlattenIterableSubscriber) BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber)

Example 2 with FlattenIterableSubscriber

use of io.reactivex.rxjava3.internal.operators.flowable.FlowableFlattenIterable.FlattenIterableSubscriber in project RxJava by ReactiveX.

the class FlowableFlattenIterableTest method onErrorLate.

@Test
public void onErrorLate() {
    List<Throwable> errors = TestHelper.trackPluginErrors();
    try {
        TestSubscriberEx<Integer> ts = new TestSubscriberEx<>();
        FlattenIterableSubscriber<Integer, Integer> f = new FlattenIterableSubscriber<>(ts, Functions.justFunction(Collections.<Integer>emptyList()), 128);
        f.onSubscribe(new BooleanSubscription());
        f.onError(new TestException("first"));
        ts.assertFailureAndMessage(TestException.class, "first");
        assertTrue(errors.isEmpty());
        f.done = false;
        f.onError(new TestException("second"));
        TestHelper.assertUndeliverable(errors, 0, TestException.class, "second");
    } finally {
        RxJavaPlugins.reset();
    }
}
Also used : FlattenIterableSubscriber(io.reactivex.rxjava3.internal.operators.flowable.FlowableFlattenIterable.FlattenIterableSubscriber) BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription)

Example 3 with FlattenIterableSubscriber

use of io.reactivex.rxjava3.internal.operators.flowable.FlowableFlattenIterable.FlattenIterableSubscriber in project RxJava by ReactiveX.

the class FlowableFlattenIterableTest method fusedCurrentIteratorEmpty.

@Test
public void fusedCurrentIteratorEmpty() throws Throwable {
    TestSubscriber<Integer> ts = new TestSubscriber<>(0);
    FlattenIterableSubscriber<Integer, Integer> f = new FlattenIterableSubscriber<>(ts, Functions.justFunction(Arrays.<Integer>asList(1, 2)), 128);
    f.onSubscribe(new BooleanSubscription());
    f.onNext(1);
    assertFalse(f.isEmpty());
    assertEquals(1, f.poll().intValue());
    assertFalse(f.isEmpty());
    assertEquals(2, f.poll().intValue());
    assertTrue(f.isEmpty());
}
Also used : FlattenIterableSubscriber(io.reactivex.rxjava3.internal.operators.flowable.FlowableFlattenIterable.FlattenIterableSubscriber) BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber)

Aggregations

FlattenIterableSubscriber (io.reactivex.rxjava3.internal.operators.flowable.FlowableFlattenIterable.FlattenIterableSubscriber)3 BooleanSubscription (io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription)3 TestSubscriber (io.reactivex.rxjava3.subscribers.TestSubscriber)2