@Test
  public void shouldUpdateRunnerWithStatusDone() {
    when(runner.getStatus()).thenReturn(Runner.Status.DONE);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).greenColor();

    shouldUpdateItemWidgetParameter();
  }
  @Test
  public void shouldUpdateRunnerWithStatusTimeOut() {
    when(runner.getStatus()).thenReturn(Runner.Status.TIMEOUT);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).whiteColor();

    shouldUpdateItemWidgetParameter();
  }
  @Test
  public void shouldUpdateRunnerWithStatusStopped() {
    when(runner.getStatus()).thenReturn(Runner.Status.STOPPED);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).redColor();

    shouldUpdateItemWidgetParameter();
  }
  @Test
  public void shouldUpdateRunnerWithStatusInProgress() {
    when(runner.getStatus()).thenReturn(IN_PROGRESS);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).blueColor();

    shouldUpdateItemWidgetParameter();
  }
  @Test
  public void shouldUpdateRunnerWithStatusQueue() {
    when(runner.getStatus()).thenReturn(Runner.Status.IN_QUEUE);
    when(css.blueColor()).thenReturn(TEXT);

    runnerWidget.update(runner);

    verify(css).yellowColor();

    shouldUpdateItemWidgetParameter();
  }
  @Test
  public void clickEventShouldBePerformedWhenRunnerStatusIsNotFailedOrStopped() throws Exception {
    when(runner.getStatus()).thenReturn(DONE);
    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(clickCaptor.capture(), eq(ClickEvent.getType()));

    clickCaptor.getValue().onClick(clickEvent);

    verify(delegate, never()).removeRunnerWidget(runner);
  }
  @Test
  public void onMouseOutEventShouldBePerformed() throws Exception {
    when(runner.getStatus()).thenReturn(IN_PROGRESS);
    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(mouseOutCaptor.capture(), eq(MouseOutEvent.getType()));

    mouseOutCaptor.getValue().onMouseOut(mouseOutEvent);

    verify(itemWidget).setImage(any(SVGImage.class));
  }
  @Test
  public void imageShouldNotBeSetWhenStatusIsNotFailedOrStopped() throws Exception {
    when(runner.getStatus()).thenReturn(DONE);

    runnerWidget.update(runner);
    reset(itemWidget);

    verify(imagePanel).addDomHandler(mouseOverCaptor.capture(), eq(MouseOverEvent.getType()));

    mouseOverCaptor.getValue().onMouseOver(mouseOverEvent);

    verify(itemWidget, never()).setImage(any(SVGImage.class));
  }
 private void changeURLDependingOnState(@NotNull Runner runner) {
   switch (runner.getStatus()) {
     case IN_PROGRESS:
       view.setApplicationURl(locale.uplAppWaitingForBoot());
       break;
     case IN_QUEUE:
       view.setApplicationURl(locale.uplAppWaitingForBoot());
       break;
     case STOPPED:
       view.setApplicationURl(locale.urlAppRunnerStopped());
       break;
     case FAILED:
       view.setApplicationURl(null);
       break;
     default:
       String url = runner.getApplicationURL();
       view.setApplicationURl(url == null ? locale.urlAppRunning() : url);
       setDebugPort(runner);
   }
 }
  @Test
  public void clickEventShouldBePerformedWhenRunnerStatusIsStopped() throws Exception {
    when(runner.getStatus()).thenReturn(STOPPED);

    verifyClickEvent();
  }
  @Test
  public void onMouseOverEventShouldBePerformedWhenRunnerStatusIsFailed() throws Exception {
    when(runner.getStatus()).thenReturn(FAILED);

    verifyMouseOverEvent();
  }