TerminalImpl extends Composite implements Terminal { @Override public void update(@Nullable Runner runner) { if (runner == null) { updateTerminalContent(null); return; } if (STOPPED_STATUS.contains(runner.getStatus())) { showStub(locale.runnerNotReady()); return; } terminal.getElement().focus(); String newTerminalUrl = runner.getTerminalURL(); if (LAUNCHING_STATUS.contains(runner.getStatus()) || url != null && url.equals(newTerminalUrl)) { if (isFirstActivated && (DONE.equals(runner.getStatus()) || RUNNING.equals(runner.getStatus()))) { updateTerminalContent(url); } return; } url = newTerminalUrl; updateTerminalContent(url); } @Inject  TerminalImpl(RunnerResources resources,
                        final SelectionManager selectionManager,
                        final RunnerLocalizationConstant locale,
                        TimerFactory timerFactory); @Override void update(@Nullable Runner runner); @Override void setVisible(boolean visible); @Override void setUnavailableLabelVisible(boolean isVisible); @Override void setUrl(@NotNull Runner runner); @Override void removeUrl();  }
@Test public void stubShouldBeShownWhenRunnerIsStopped() throws Exception { when(runner.getStatus()).thenReturn(STOPPED); terminal.update(runner); verify(locale).runnerNotReady(); verifyShowStub(); }
@Test public void stubShouldBeShownWhenRunnerIsFailed() throws Exception { when(runner.getStatus()).thenReturn(FAILED); terminal.update(runner); verify(locale).runnerNotReady(); verifyShowStub(); }