use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class AsyncSubscriptionTest method testCancelOnce.
@Test
public void testCancelOnce() {
Disposable r = mock(Disposable.class);
AsyncSubscription as = new AsyncSubscription(r);
Subscription s = mock(Subscription.class);
as.setSubscription(s);
as.cancel();
as.cancel();
as.cancel();
verify(s, never()).request(anyLong());
verify(s).cancel();
verify(r).dispose();
}
use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class AsyncSubscriptionTest method testInitialResource.
@Test
public void testInitialResource() {
Disposable r = mock(Disposable.class);
AsyncSubscription as = new AsyncSubscription(r);
as.cancel();
verify(r).dispose();
}
use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class AsyncSubscriptionTest method testReplaceResource.
@Test
public void testReplaceResource() {
AsyncSubscription as = new AsyncSubscription();
Disposable r = mock(Disposable.class);
assertTrue(as.replaceResource(r));
as.cancel();
verify(r).dispose();
}
use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class AsyncSubscriptionTest method testSetResourceAfterCancel.
@Test
public void testSetResourceAfterCancel() {
AsyncSubscription as = new AsyncSubscription();
as.cancel();
Disposable r = mock(Disposable.class);
as.setResource(r);
verify(r).dispose();
}
use of io.reactivex.disposables.Disposable in project RxJava by ReactiveX.
the class ExecutorSchedulerTest method runnableDisposed.
@Test
public void runnableDisposed() {
final Scheduler s = Schedulers.from(new Executor() {
@Override
public void execute(Runnable r) {
r.run();
}
});
Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE);
assertTrue(d.isDisposed());
}
Aggregations