@Test
  public void stopButtonStateShouldBeRefreshedWhenConsoleHasRunningProcess() {
    ProcessTreeNode commandNode = mock(ProcessTreeNode.class);
    when(commandNode.getId()).thenReturn(PROCESS_ID);

    when(outputConsole.isFinished()).thenReturn(false);
    presenter.consoles.put(PROCESS_ID, outputConsole);

    presenter.onTreeNodeSelected(commandNode);

    verify(view).setProcessRunning(PROCESS_ID, true);
  }
  @Test
  public void shouldShowTerminalWhenTerminalNodeSelected() throws Exception {
    TerminalPresenter terminal = mock(TerminalPresenter.class);
    presenter.terminals.put(PROCESS_ID, terminal);

    ProcessTreeNode terminalNode = mock(ProcessTreeNode.class);
    when(terminalNode.getId()).thenReturn(PROCESS_ID);
    presenter.onTreeNodeSelected(terminalNode);

    verify(view).showProcessOutput(eq(PROCESS_ID));
    verify(view, never()).setProcessRunning(PROCESS_ID, true);
  }
  @Test
  public void shouldShowCommanOutputWhenCommandSelected() throws Exception {
    ProcessTreeNode commandNode = mock(ProcessTreeNode.class);
    when(commandNode.getId()).thenReturn(PROCESS_ID);

    presenter.consoles.put(PROCESS_ID, outputConsole);

    presenter.onTreeNodeSelected(commandNode);

    verify(view).showProcessOutput(eq(PROCESS_ID));
    verify(view).setProcessRunning(anyString(), eq(true));
  }