@Test public void testActivityPreventIdle() { setupToRun(); final int activityAtTime = 3; TimerHandler hdlr = timerHandlerInt.getObject(); final States state = context.states("time").startsAs("notLast"); context.checking(new Expectations() { { oneOf(timer).cancel(); when(state.is("last")); } }); for (int i = 1; i <= IDLE_TIMEOUT + activityAtTime; i++) { if (i == IDLE_TIMEOUT + activityAtTime) { state.become("last"); } if (i == activityAtTime) { sut.userActivityDetected(); } hdlr.run(); incrementTime(); } 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();  }