@Test
  @Ignore
  public void testQueryForResources() throws Exception {
    StageResourceProvider provider = new StageResourceProvider(managementController);

    Request request = createNiceMock(Request.class);
    Predicate predicate = createNiceMock(Predicate.class);

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

    expect(dao.findAll(request, predicate)).andReturn(entities);

    expect(clusters.getClusterById(anyLong())).andReturn(cluster).anyTimes();
    expect(cluster.getClusterName()).andReturn("c1").anyTimes();

    replay(dao, clusters, cluster, request, predicate);

    QueryResponse response =  provider.queryForResources(request, predicate);

    Set<Resource> resources = response.getResources();

    Assert.assertEquals(1, resources.size());

    Assert.assertFalse(response.isSortedResponse());
    Assert.assertFalse(response.isPagedResponse());
    Assert.assertEquals(1, response.getTotalResourceCount());

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