### Question:
IdleNotifierPlugin extends Plugin { @Subscribe public void onGameTick(GameTick event) { final Player local = client.getLocalPlayer(); final Duration waitDuration = Duration.ofMillis(config.getIdleNotificationDelay()); lastCombatCountdown = Math.max(lastCombatCountdown - 1, 0); if (client.getGameState() != GameState.LOGGED_IN || local == null || System.currentTimeMillis() - client.getMouseLastPressedMillis() < 1000 || client.getKeyboardIdleTicks() < 10) { resetTimers(); return; } if (config.logoutIdle() && checkIdleLogout()) { notifier.notify("[" + local.getName() + "] is about to log out from idling too long!"); } if (check6hrLogout()) { notifier.notify("[" + local.getName() + "] is about to log out from being online for 6 hours!"); } if (config.animationIdle() && checkAnimationIdle(waitDuration, local)) { notifier.notify("[" + local.getName() + "] is now idle!"); } if (config.interactionIdle() && checkInteractionIdle(waitDuration, local)) { if (lastInteractWasCombat) { notifier.notify("[" + local.getName() + "] is now out of combat!"); } else { notifier.notify("[" + local.getName() + "] is now idle!"); } } if (checkLowHitpoints()) { notifier.notify("[" + local.getName() + "] has low hitpoints!"); } if (checkLowPrayer()) { notifier.notify("[" + local.getName() + "] has low prayer!"); } if (checkLowOxygen()) { notifier.notify("[" + local.getName() + "] has low oxygen!"); } if (checkFullSpecEnergy()) { notifier.notify("[" + local.getName() + "] has restored spec energy!"); } }  @Subscribe void onAnimationChanged(AnimationChanged event); @Subscribe void onInteractingChanged(InteractingChanged event); @Subscribe void onGameStateChanged(GameStateChanged gameStateChanged); @Subscribe void onHitsplatApplied(HitsplatApplied event); @Subscribe void onGraphicChanged(GraphicChanged event); @Subscribe void onGameTick(GameTick event);  }### Answer:
@Test public void doubleNotifyOnMouseReset() { when(client.getKeyboardIdleTicks()).thenReturn(80_000); when(client.getMouseIdleTicks()).thenReturn(14_500); plugin.onGameTick(new GameTick()); plugin.onGameTick(new GameTick()); verify(notifier, times(1)).notify(any()); }
@Test public void testSpecRegen() { when(config.getSpecEnergyThreshold()).thenReturn(50); when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(400); plugin.onGameTick(new GameTick()); verify(notifier, never()).notify(any()); when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(500); plugin.onGameTick(new GameTick()); verify(notifier).notify(Matchers.eq("[" + PLAYER_NAME + "] has restored spec energy!")); }