private List<StageEntity> getStageEntities(HostRoleStatus lastTaskStatus) {
    StageEntity stage = new StageEntity();

    HostRoleCommandEntity task1 = new HostRoleCommandEntity();
    task1.setStatus(HostRoleStatus.COMPLETED);
    task1.setStartTime(1000L);
    task1.setEndTime(2000L);

    HostRoleCommandEntity task2 = new HostRoleCommandEntity();
    task2.setStatus(lastTaskStatus);
    task2.setStartTime(1500L);
    task2.setEndTime(2500L);


    Collection<HostRoleCommandEntity> tasks = new HashSet<>();
    tasks.add(task1);
    tasks.add(task2);

    stage.setHostRoleCommands(tasks);
    stage.setRequestId(1L);

    List<StageEntity> entities = new LinkedList<>();
    entities.add(stage);
    return entities;
  }
Tests getting the display status of a stage which can differ from the final
status.

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