CheckHealthStatusAction extends AbstractRunnerAction { @Override public void stop() { if (webSocketChannel == null || runnerHealthHandler == null) { return; } webSocketUtil.unSubscribeHandler(webSocketChannel, runnerHealthHandler); if (changeAppAliveTimer != null) { changeAppAliveTimer.cancel(); } super.stop(); webSocketChannel = null; runnerHealthHandler = null; } @Inject  CheckHealthStatusAction(AppContext appContext,
                                   RunnerLocalizationConstant locale,
                                   RunnerManagerPresenter presenter,
                                   WebSocketUtil webSocketUtil,
                                   ConsoleContainer consoleContainer,
                                   TimerFactory timerFactory,
                                   @NotNull @Assisted Notification notification); @Override void perform(@NotNull final Runner runner); @Override void stop();  }
@Test public void shouldStopWhenTimerAndWebSocketChannelAndRunnerHealthHandlerAreNull() throws Exception { checkHealthStatusAction.stop(); verify(webSocketUtil, never()).unSubscribeHandler(isNull(String.class), isNull(SubscriptionHandler.class)); verify(changeAppAliveTimer, never()).cancel(); }