use of io.reactivex.rxjava3.internal.disposables.EmptyDisposable in project RxJava by ReactiveX.
the class AbstractSchedulerTests method unwrapScheduleDirectTask.
@Test
public void unwrapScheduleDirectTask() {
Scheduler scheduler = getScheduler();
if (scheduler instanceof TrampolineScheduler) {
// TrampolineScheduler always return EmptyDisposable
return;
}
final CountDownLatch cdl = new CountDownLatch(1);
Runnable countDownRunnable = new Runnable() {
@Override
public void run() {
cdl.countDown();
}
};
Disposable disposable = scheduler.scheduleDirect(countDownRunnable, 100, TimeUnit.MILLISECONDS);
SchedulerRunnableIntrospection wrapper = (SchedulerRunnableIntrospection) disposable;
assertSame(countDownRunnable, wrapper.getWrappedRunnable());
disposable.dispose();
}
use of io.reactivex.rxjava3.internal.disposables.EmptyDisposable in project RxJava by ReactiveX.
the class AbstractSchedulerTests method unwrapDefaultPeriodicTask.
@Test
public void unwrapDefaultPeriodicTask() throws InterruptedException {
Scheduler s = getScheduler();
if (s instanceof TrampolineScheduler) {
// TrampolineScheduler always return EmptyDisposable
return;
}
final CountDownLatch cdl = new CountDownLatch(1);
Runnable countDownRunnable = new Runnable() {
@Override
public void run() {
cdl.countDown();
}
};
Disposable disposable = s.schedulePeriodicallyDirect(countDownRunnable, 100, 100, TimeUnit.MILLISECONDS);
SchedulerRunnableIntrospection wrapper = (SchedulerRunnableIntrospection) disposable;
assertSame(countDownRunnable, wrapper.getWrappedRunnable());
assertTrue(cdl.await(5, TimeUnit.SECONDS));
disposable.dispose();
}
Aggregations