OutputAction extends AbstractRunnerAction implements LogMessagesHandler.ErrorHandler { @Override public void stop() { if (webSocketChannel == null || runnerOutputHandler == null) { return; } webSocketUtil.unSubscribeHandler(webSocketChannel, runnerOutputHandler); super.stop(); webSocketChannel = null; runnerOutputHandler = null; } @Inject  OutputAction(HandlerFactory handlerFactory, WebSocketUtil webSocketUtil); @Override void perform(@NotNull Runner runner); @Override void stop(); @Override void onErrorHappened(); static final String OUTPUT_CHANNEL; }
@Test public void actionShouldNotBeStoppedWhenWeTryStopItTwice() throws Exception { action.stop(); reset(webSocketUtil); action.stop(); verify(webSocketUtil, never()).unSubscribeHandler(anyString(), any(LogMessagesHandler.class)); }