@Test
  public void testCountsWithRepeatHosts() throws Exception {
    List<Stage> stages = new ArrayList<>();

      stages.addAll(getStages(getTaskEntities(
          HostRoleStatus.COMPLETED, HostRoleStatus.COMPLETED,
          HostRoleStatus.COMPLETED, HostRoleStatus.COMPLETED)));

    // create 5th stage that is a repeat of an earlier one
    HostRoleCommandEntity entity = new HostRoleCommandEntity();
    entity.setTaskId(taskId++);
    entity.setStatus(HostRoleStatus.PENDING);
    stages.addAll(getStages(Collections.singleton(entity)));

    CalculatedStatus calc = CalculatedStatus.statusFromStages(stages);

    assertEquals(HostRoleStatus.IN_PROGRESS, calc.getStatus());
    assertEquals(80d, calc.getPercent(), 0.1d);
  }
Tests that aborted states calculate correctly. This is needed for upgrades
where the upgrade can be ABORTED and must not be calculated as COMPLETED.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CalculatedStatusTest.java