ScheduledDirectPeriodicTask extends AbstractDirectTask implements Runnable { @Override public void run() { runner = Thread.currentThread(); try { runnable.run(); runner = null; } catch (Throwable ex) { runner = null; lazySet(FINISHED); RxJavaPlugins.onError(ex); } } ScheduledDirectPeriodicTask(Runnable runnable); @Override void run();  }
@Test public void runnableThrows() { List<Throwable> errors = TestHelper.trackPluginErrors(); try { ScheduledDirectPeriodicTask task = new ScheduledDirectPeriodicTask(new Runnable() { @Override public void run() { throw new TestException(); } }); task.run(); TestHelper.assertUndeliverable(errors, 0, TestException.class); } finally { RxJavaPlugins.reset(); } }