@Test
  public void testUpdateStageStatus_aborted() throws Exception {
    StageResourceProvider provider = new StageResourceProvider(managementController);
    ActionManager actionManager = createNiceMock(ActionManager.class);

    Predicate predicate = new PredicateBuilder().property(StageResourceProvider.STAGE_STAGE_ID).equals(2L).and().
        property(StageResourceProvider.STAGE_REQUEST_ID).equals(1L).toPredicate();

    Map<String, Object> requestProps = new HashMap<>();
    requestProps.put(StageResourceProvider.STAGE_STATUS, HostRoleStatus.ABORTED.name());
    Request request = PropertyHelper.getUpdateRequest(requestProps, null);

    List<StageEntity> entities = getStageEntities(HostRoleStatus.HOLDING);

    expect(dao.findAll(request, predicate)).andReturn(entities);
    expect(managementController.getActionManager()).andReturn(actionManager).anyTimes();

    dao.updateStageStatus(entities.get(0), HostRoleStatus.ABORTED, actionManager);
    EasyMock.expectLastCall().atLeastOnce();

    replay(dao, clusters, cluster, actionManager, managementController);

    provider.updateResources(request, predicate);

    verify(dao, clusters, cluster, actionManager, managementController);
  }
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