Search in sources :

Example 1 with EmptyComponent

use of io.reactivex.internal.util.EmptyComponent in project RxJava by ReactiveX.

the class EmptyComponentTest method normal.

@Test
public void normal() {
    List<Throwable> errors = TestHelper.trackPluginErrors();
    try {
        TestHelper.checkEnum(EmptyComponent.class);
        EmptyComponent c = EmptyComponent.INSTANCE;
        assertTrue(c.isDisposed());
        c.request(10);
        c.request(-10);
        Disposable d = Disposables.empty();
        c.onSubscribe(d);
        assertTrue(d.isDisposed());
        BooleanSubscription s = new BooleanSubscription();
        c.onSubscribe(s);
        assertTrue(s.isCancelled());
        c.onNext(null);
        c.onNext(1);
        c.onComplete();
        c.onError(new TestException());
        c.onSuccess(2);
        c.cancel();
        TestHelper.assertUndeliverable(errors, 0, TestException.class);
    } finally {
        RxJavaPlugins.reset();
    }
}
Also used : EmptyComponent(io.reactivex.internal.util.EmptyComponent) BooleanSubscription(io.reactivex.internal.subscriptions.BooleanSubscription) TestException(io.reactivex.exceptions.TestException) Test(org.junit.Test)

Aggregations

TestException (io.reactivex.exceptions.TestException)1 BooleanSubscription (io.reactivex.internal.subscriptions.BooleanSubscription)1 EmptyComponent (io.reactivex.internal.util.EmptyComponent)1 Test (org.junit.Test)1