Search in sources :

Example 1 with DelayedRunnable

use of io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler.DelayedRunnable in project RxJava by ReactiveX.

the class ExecutorSchedulerDelayedRunnableTest method delayedRunnableCrash.

@Test(expected = TestException.class)
@SuppressUndeliverable
public void delayedRunnableCrash() {
    DelayedRunnable dl = new DelayedRunnable(new Runnable() {

        @Override
        public void run() {
            throw new TestException();
        }
    });
    dl.run();
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) DelayedRunnable(io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler.DelayedRunnable) DelayedRunnable(io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler.DelayedRunnable) RxJavaTest(io.reactivex.rxjava3.core.RxJavaTest) Test(org.junit.Test) SuppressUndeliverable(io.reactivex.rxjava3.testsupport.SuppressUndeliverable)

Example 2 with DelayedRunnable

use of io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler.DelayedRunnable in project RxJava by ReactiveX.

the class ExecutorSchedulerDelayedRunnableTest method dispose.

@Test
public void dispose() {
    final AtomicInteger count = new AtomicInteger();
    DelayedRunnable dl = new DelayedRunnable(new Runnable() {

        @Override
        public void run() {
            count.incrementAndGet();
        }
    });
    dl.dispose();
    dl.dispose();
    dl.run();
    assertEquals(0, count.get());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DelayedRunnable(io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler.DelayedRunnable) DelayedRunnable(io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler.DelayedRunnable) RxJavaTest(io.reactivex.rxjava3.core.RxJavaTest) Test(org.junit.Test)

Aggregations

RxJavaTest (io.reactivex.rxjava3.core.RxJavaTest)2 DelayedRunnable (io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler.DelayedRunnable)2 Test (org.junit.Test)2 TestException (io.reactivex.rxjava3.exceptions.TestException)1 SuppressUndeliverable (io.reactivex.rxjava3.testsupport.SuppressUndeliverable)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1