RepeatingRunnable implements Runnable { public static Cancelable startInDaemon(double delay, double period, String description, Runnable r, EventScheduler eventScheduler) { return startInDaemon(delay, period, description, eventTime -> r.run(), eventScheduler); } private  RepeatingRunnable(
            double time,
            double period,
            String description,
            Consumer<Double> timeConsumingAction,
            EventScheduler eventScheduler,
            boolean isDaemon,
            AtomicBoolean canceled,
            boolean fixedDelay); static Cancelable startIn(double delay, double period, String description, Consumer<Double> timeConsumingAction, EventScheduler eventScheduler); static Cancelable startAt(double time, double period, String description, Consumer<Double> timeConsumingAction, EventScheduler eventScheduler); static Cancelable startAtDaemon(double time, double period, String description, Runnable r, EventScheduler eventScheduler); static Cancelable startAtDaemon(double time, double period, String description, Consumer<Double> timeConsumingAction, EventScheduler eventScheduler); static Cancelable startInDaemon(double delay, double period, String description, Runnable r, EventScheduler eventScheduler); static Cancelable startInDaemon(double delay, double period, String description, Consumer<Double> timeConsumingAction, EventScheduler eventScheduler); static Cancelable startInWithFixedDelay(double delay, double period, String description, Consumer<Double> timeConsumingAction, EventScheduler eventScheduler); static Cancelable startAtWithFixedDelay(double time, double period, String description, Consumer<Double> timeConsumingAction, EventScheduler eventScheduler); static Cancelable startAtDaemonWithFixedDelay(double time, double period, String description, Runnable r, EventScheduler eventScheduler); static Cancelable startAtDaemonWithFixedDelay(double time, double period, String description, Consumer<Double> timeConsumingAction, EventScheduler eventScheduler); static Cancelable startInDaemonWithFixedDelay(double delay, double period, String description, Runnable r, EventScheduler eventScheduler); static Cancelable startInDaemonWithFixedDelay(double delay, double period, String description, Consumer<Double> timeConsumingAction, EventScheduler eventScheduler); @Override void run();  }
@Test public void whenRunnableIsADamonEvent_theSchedulerKnowsItHasOnlyDamonEvents() { simpleDiscreteEventScheduler.pause(); RepeatingRunnable.startInDaemon(0, 1, "Test Event", time -> {}, simpleDiscreteEventScheduler); simpleDiscreteEventScheduler.doAt(20, () -> Preconditions.checkState(simpleDiscreteEventScheduler.hasOnlyDaemonEvents())); simpleDiscreteEventScheduler.doAtDaemon(100, simpleDiscreteEventScheduler::stop, "Shutdown Event"); simpleDiscreteEventScheduler.unPause(); Assertions.assertNull(exceptionSwallowingEventExecutor.getFirstExceptionEncountered()); }