Search in sources :

Example 1 with StrictSubscriber

use of io.reactivex.internal.subscribers.StrictSubscriber in project RxJava by ReactiveX.

the class FlowableStrictTest method badRequestOnNextRace.

@Test
public void badRequestOnNextRace() {
    for (int i = 0; i < 500; i++) {
        TestSubscriber<Integer> ts = new TestSubscriber<Integer>();
        final PublishProcessor<Integer> pp = PublishProcessor.create();
        final StrictSubscriber<Integer> s = new StrictSubscriber<Integer>(ts);
        s.onSubscribe(new BooleanSubscription());
        Runnable r1 = new Runnable() {

            @Override
            public void run() {
                pp.onNext(1);
            }
        };
        Runnable r2 = new Runnable() {

            @Override
            public void run() {
                s.request(0);
            }
        };
        TestHelper.race(r1, r2);
        if (ts.valueCount() == 0) {
            ts.assertFailure(IllegalArgumentException.class);
        } else {
            ts.assertValue(1).assertNoErrors().assertNotComplete();
        }
    }
}
Also used : BooleanSubscription(io.reactivex.internal.subscriptions.BooleanSubscription) TestSubscriber(io.reactivex.subscribers.TestSubscriber) StrictSubscriber(io.reactivex.internal.subscribers.StrictSubscriber) Test(org.junit.Test)

Aggregations

StrictSubscriber (io.reactivex.internal.subscribers.StrictSubscriber)1 BooleanSubscription (io.reactivex.internal.subscriptions.BooleanSubscription)1 TestSubscriber (io.reactivex.subscribers.TestSubscriber)1 Test (org.junit.Test)1