### Question:
CalculatedStatus { public double getPercent() { return percent; } private  CalculatedStatus(HostRoleStatus status, double percent); private  CalculatedStatus(HostRoleStatus status, HostRoleStatus displayStatus, double percent); HostRoleStatus getStatus(); HostRoleStatus getDisplayStatus(); double getPercent(); static CalculatedStatus statusFromTaskEntities(Collection<HostRoleCommandEntity> tasks, boolean skippable); static CalculatedStatus statusFromStageEntities(Collection<StageEntity> stages); static CalculatedStatus statusFromStages(Collection<Stage> stages); static Map<HostRoleStatus, Integer> calculateStatusCounts(Collection<HostRoleStatus> hostRoleStatuses); static Map<HostRoleStatus, Integer> calculateStatusCountsForTasks(Collection<HostRoleCommand> hostRoleCommands); static Map<StatusType,Map<HostRoleStatus, Integer>> calculateStatusCountsForStage(Collection<TaskStatusListener.ActiveStage> stages); static Map<HostRoleStatus, Integer> calculateStatusCountsForTasks(Collection<HostRoleCommand> hostRoleCommands, StageEntityPK stage); static Map<HostRoleStatus, Integer> calculateTaskEntityStatusCounts(Collection<HostRoleCommandEntity> tasks); static Map<HostRoleStatus, Integer> calculateTaskStatusCounts(
      Map<Long, HostRoleCommandStatusSummaryDTO> stageDto, Set<Long> stageIds); static CalculatedStatus statusFromRequest(HostRoleCommandDAO s_hostRoleCommandDAO,
                                                   TopologyManager topologyManager, Long requestId); static CalculatedStatus statusFromStageSummary(Map<Long, HostRoleCommandStatusSummaryDTO> stageDto,
      Set<Long> stageIds); static HostRoleStatus calculateSummaryStatus(Map<HostRoleStatus, Integer> counters,
      int total, boolean skippable); static HostRoleStatus calculateSummaryStatusFromPartialSet(Map<HostRoleStatus, Integer> counters,
                                                      boolean skippable); static HostRoleStatus calculateStageStatus(List <HostRoleCommand> hostRoleCommands, Map<HostRoleStatus, Integer> counters, Map<Role, Float> successFactors,
                                                    boolean skippable); static HostRoleStatus getOverallStatusForRequest(Collection<HostRoleStatus> hostRoleStatuses); static HostRoleStatus getOverallDisplayStatusForRequest(Collection<HostRoleStatus> hostRoleStatuses); static HostRoleStatus calculateSummaryDisplayStatus(
      Map<HostRoleStatus, Integer> counters, int total, boolean skippable); static final CalculatedStatus COMPLETED; static final CalculatedStatus PENDING; static final CalculatedStatus ABORTED; }### Answer:
@Test public void testGetPercent() throws Exception { Collection<HostRoleCommandEntity> tasks = getTaskEntities(HostRoleStatus.COMPLETED, HostRoleStatus.COMPLETED, HostRoleStatus.PENDING, HostRoleStatus.PENDING, HostRoleStatus.PENDING); CalculatedStatus status = CalculatedStatus.statusFromTaskEntities(tasks, false); assertEquals(40.0, status.getPercent(), 0.1); }