use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class ResourceMaybeObserverTest method onErrorCleansUp.
@Test
public void onErrorCleansUp() {
TestResourceMaybeObserver<Integer> rmo = new TestResourceMaybeObserver<Integer>();
assertFalse(rmo.isDisposed());
Disposable d = Disposables.empty();
rmo.add(d);
assertFalse(d.isDisposed());
rmo.onError(new TestException());
assertTrue(rmo.isDisposed());
assertTrue(d.isDisposed());
}
use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class ResourceMaybeObserverTest method addResources.
@Test
public void addResources() {
TestResourceMaybeObserver<Integer> rmo = new TestResourceMaybeObserver<Integer>();
assertFalse(rmo.isDisposed());
Disposable d = Disposables.empty();
rmo.add(d);
assertFalse(d.isDisposed());
rmo.dispose();
assertTrue(rmo.isDisposed());
assertTrue(d.isDisposed());
rmo.dispose();
assertTrue(rmo.isDisposed());
assertTrue(d.isDisposed());
}
use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class ResourceMaybeObserverTest method onCompleteCleansUp.
@Test
public void onCompleteCleansUp() {
TestResourceMaybeObserver<Integer> rmo = new TestResourceMaybeObserver<Integer>();
assertFalse(rmo.isDisposed());
Disposable d = Disposables.empty();
rmo.add(d);
assertFalse(d.isDisposed());
rmo.onComplete();
assertTrue(rmo.isDisposed());
assertTrue(d.isDisposed());
}
use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class ResourceMaybeObserverTest method startOnce.
@Test
public void startOnce() {
List<Throwable> error = TestHelper.trackPluginErrors();
try {
TestResourceMaybeObserver<Integer> rmo = new TestResourceMaybeObserver<Integer>();
rmo.onSubscribe(Disposables.empty());
Disposable d = Disposables.empty();
rmo.onSubscribe(d);
assertTrue(d.isDisposed());
assertEquals(1, rmo.start);
TestHelper.assertError(error, 0, IllegalStateException.class, "Disposable already set!");
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class ResourceObserverTest method startOnce.
@Test
public void startOnce() {
List<Throwable> error = TestHelper.trackPluginErrors();
try {
TestResourceObserver<Integer> tc = new TestResourceObserver<Integer>();
tc.onSubscribe(Disposables.empty());
Disposable d = Disposables.empty();
tc.onSubscribe(d);
assertTrue(d.isDisposed());
assertEquals(1, tc.start);
TestHelper.assertError(error, 0, IllegalStateException.class, "Disposable already set!");
} finally {
RxJavaPlugins.reset();
}
}
Aggregations