@Test public void testActivityRestartFromIdle() { setupToRun(); TimerHandler hdlr = timerHandlerInt.getObject(); final States state = context.states("time").startsAs("makeIdle"); context.checking(new Expectations() { { oneOf(timer).cancel(); when(state.is("makeIdle")); } }); for (int i = 1; i <= IDLE_TIMEOUT; i++) { if (i == IDLE_TIMEOUT) { state.become("makeIdle"); } hdlr.run(); incrementTime(); } context.checking(new Expectations() { { oneOf(timer).scheduleRepeating(with(any(Integer.class))); } }); sut.userActivityDetected(); context.assertIsSatisfied(); }
public void userActivityDetected() { activity = true; if (idle) { startTimer(); } }
PeriodicEventManager { public void userActivityDetected() { activity = true; if (idle) { startTimer(); } } }
PeriodicEventManager { public void userActivityDetected() { activity = true; if (idle) { startTimer(); } } PeriodicEventManager(final long inIdleTimeout, final TimerFactory inTimerFactory,
            final ActionProcessor inActionProcessor); }
PeriodicEventManager { public void userActivityDetected() { activity = true; if (idle) { startTimer(); } } PeriodicEventManager(final long inIdleTimeout, final TimerFactory inTimerFactory,
            final ActionProcessor inActionProcessor); void register(final TimerHandler handler, final int period); void deregister(final TimerHandler handler); void start(); void userActivityDetected(); }
PeriodicEventManager { public void userActivityDetected() { activity = true; if (idle) { startTimer(); } } PeriodicEventManager(final long inIdleTimeout, final TimerFactory inTimerFactory,
            final ActionProcessor inActionProcessor); void register(final TimerHandler handler, final int period); void deregister(final TimerHandler handler); void start(); void userActivityDetected();  }