TimerTools { public void scheduleTimerTask(@NonNls final String name, final TimerTask timerTask, final long delay) { final Timer delayedLogonTimer = new Timer(name); delayedLogonTimer.schedule(timerTask, delay); }  void scheduleTimerTask(@NonNls final String name, final TimerTask timerTask, final long delay);  }
@Test public void scheduleTimerTaskShouldScheduleOneTimeTaskWithCorrectNameAndDelay() throws Exception { final Timer timer = mock(Timer.class); final TimerTask timerTask = createTimerTask(); whenNew(Timer.class).withAnyArguments().thenReturn(timer); timerTools.scheduleTimerTask("TheTimer", timerTask, 123); verifyNew(Timer.class).withArguments("TheTimer"); verify(timer).schedule(timerTask, 123); }