@Test
  public void testGetCompletedStatusForNoTasks() throws Exception {
    // no status / no tasks
    CalculatedStatus status = CalculatedStatus.statusFromTaskEntities(
      new ArrayList<>(), false);

    assertEquals(HostRoleStatus.COMPLETED, status.getStatus());

    // empty summaries
    status = CalculatedStatus.statusFromStageSummary(
      new HashMap<>(), new HashSet<>());

    assertEquals(HostRoleStatus.COMPLETED, status.getStatus());

    // generate a map of 0's - COMPLETED=0, IN_PROGRESS=0, etc
    Map<HostRoleStatus, Integer> counts = CalculatedStatus.calculateStatusCounts(new ArrayList<>());
    Map<HostRoleStatus, Integer> displayCounts = CalculatedStatus.calculateStatusCounts(new ArrayList<>());

    HostRoleStatus hostRoleStatus = CalculatedStatus.calculateSummaryStatusOfUpgrade(counts, 0);
    HostRoleStatus hostRoleDisplayStatus = CalculatedStatus.calculateSummaryDisplayStatus(displayCounts, 0, false);

    assertEquals(HostRoleStatus.COMPLETED, hostRoleStatus);
    assertEquals(HostRoleStatus.COMPLETED, hostRoleDisplayStatus);
  }
Tests that when there are no tasks and all counts are 0, that the returned
status is {@link HostRoleStatus#COMPLETED}.

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