FixedRateTimerActionScheduler implements ActionScheduler { @Override public void cancelAll() { for (Map.Entry<Action, TimerTask> timerTaskEntry : actionTimerTasks.entrySet()) { TimerTask timerTask = timerTaskEntry.getValue(); timerTask.cancel(); } actionTimerTasks.clear(); } FixedRateTimerActionScheduler(Timer timer, long frequencyInMillis, Map<Action, TimerTask> actionTimerTasks); @Override void schedule(final Action action); @Override void cancel(Action action); @Override void cancelAll(); @Override boolean isScheduled(Action action);  }
@Test public void clearsAllActions_whenCancellingAll() { givenScheduledAction(); scheduler.cancelAll(); assertThat(actionTimerTasks).isEmpty(); }