TerminalImpl extends Composite implements Terminal { @Override public void setUrl(@NotNull Runner runner) { String terminalUrl = runner.getTerminalURL(); if (terminalUrl == null) { showStub(locale.terminalNotReady()); return; } if (terminalUrl.equals(url)) { return; } url = terminalUrl; setUrlTimer.schedule(ONE_SEC.getValue()); } @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 urlShouldBeSet() throws Exception { when(runner.getTerminalURL()).thenReturn(SOME_TEXT); terminal.setUrl(runner); verify(timer).schedule(ONE_SEC.getValue()); }
@Test public void stubShouldBeShownWhenUrlIsNull() { when(runner.getApplicationURL()).thenReturn(null); terminal.setUrl(runner); verify(locale).terminalNotReady(); verifyShowStub(); }
@Test public void urlShouldNotBeSet() throws Exception { when(runner.getTerminalURL()).thenReturn(SOME_TEXT); terminal.setUrl(runner); when(runner.getTerminalURL()).thenReturn(SOME_TEXT); terminal.setUrl(runner); verify(timer).schedule(ONE_SEC.getValue()); }