@Test
public void testGetResources() 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);
  Set<Resource> resources = provider.getResources(request, predicate);
  Assert.assertEquals(1, resources.size());
  Resource resource = resources.iterator().next();
  Assert.assertEquals(100.0, resource.getPropertyValue(StageResourceProvider.STAGE_PROGRESS_PERCENT));
  Assert.assertEquals(HostRoleStatus.COMPLETED, resource.getPropertyValue(StageResourceProvider.STAGE_STATUS));
  Assert.assertEquals(HostRoleStatus.COMPLETED, resource.getPropertyValue(StageResourceProvider.STAGE_DISPLAY_STATUS));
  Assert.assertEquals(1000L, resource.getPropertyValue(StageResourceProvider.STAGE_START_TIME));
  Assert.assertEquals(2500L, resource.getPropertyValue(StageResourceProvider.STAGE_END_TIME));
  verify(dao, clusters, cluster);
}