@Test
  public void machineShouldBeSelectedWhenItIsRunning() {
    MachineStartingEvent startingEvent = mock(MachineStartingEvent.class);

    when(startingEvent.getMachineState()).thenReturn(machineState1);
    when(stateEvent.getMachineState()).thenReturn(machineState1);

    presenter.onMachineStarting(startingEvent);
    reset(view);

    presenter.onMachineRunning(stateEvent);

    verify(view).selectNode(machineNode1);

    assertThat(presenter.isMachineRunning(), is(true));
  }
  @Test
  public void machineShouldBeRemovedFromTreeWhenItIsDestroyed() {
    MachineStartingEvent startingEvent = mock(MachineStartingEvent.class);

    when(startingEvent.getMachineState()).thenReturn(machineState1);
    when(stateEvent.getMachineState()).thenReturn(machineState1);

    presenter.onMachineStarting(startingEvent);
    reset(view);
    presenter.onMachineRunning(stateEvent);

    verify(view).selectNode(machineNode1);

    reset(view);

    presenter.onMachineDestroyed(stateEvent);

    verify(view).setData(rootNode);
    verify(view, never()).selectNode(machineNode1);
  }