Search in sources :

Example 1 with DisposeTask

use of io.reactivex.rxjava3.core.Scheduler.DisposeTask in project RxJava by ReactiveX.

the class DisposeTaskTest method runnableThrows.

@Test
public void runnableThrows() throws Throwable {
    TestHelper.withErrorTracking(errors -> {
        Scheduler.Worker worker = Schedulers.single().createWorker();
        DisposeTask task = new DisposeTask(() -> {
            throw new TestException();
        }, worker);
        try {
            task.run();
            fail("Should have thrown!");
        } catch (TestException expected) {
        // expected
        }
        TestHelper.assertUndeliverable(errors, 0, TestException.class);
        assertTrue(worker.isDisposed());
    });
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) DisposeTask(io.reactivex.rxjava3.core.Scheduler.DisposeTask) Test(org.junit.Test)

Example 2 with DisposeTask

use of io.reactivex.rxjava3.core.Scheduler.DisposeTask in project RxJava3_BuildMatrix by akarnokd.

the class DisposeTaskTest method runnableThrows.

@Test
public void runnableThrows() throws Throwable {
    TestHelper.withErrorTracking(errors -> {
        Scheduler.Worker worker = Schedulers.single().createWorker();
        DisposeTask task = new DisposeTask(() -> {
            throw new TestException();
        }, worker);
        try {
            task.run();
            fail("Should have thrown!");
        } catch (TestException expected) {
        // expected
        }
        TestHelper.assertUndeliverable(errors, 0, TestException.class);
        assertTrue(worker.isDisposed());
    });
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException) DisposeTask(io.reactivex.rxjava3.core.Scheduler.DisposeTask) Test(org.junit.Test)

Aggregations

DisposeTask (io.reactivex.rxjava3.core.Scheduler.DisposeTask)2 TestException (io.reactivex.rxjava3.exceptions.TestException)2 Test (org.junit.Test)2