@Test
public void testGetRequestStatus() {

  Set<String> propertyIds = new HashSet<String>();
  Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>();
  AmbariManagementController managementController = createMock(AmbariManagementController.class);
  MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class);
  replay(maintenanceStateHelper);
  AbstractResourceProvider provider = new ServiceResourceProvider(
          propertyIds,
          keyPropertyIds,
          managementController, maintenanceStateHelper);
  RequestStatus status = provider.getRequestStatus(null);
  Assert.assertNull(status.getRequestResource());
  Assert.assertEquals(Collections.emptySet(), status.getAssociatedResources());
  RequestStatusResponse response = new RequestStatusResponse(99L);
  status = provider.getRequestStatus(response);
  Resource resource = status.getRequestResource();
  Assert.assertEquals(99L, resource.getPropertyValue("Requests/id"));
  Assert.assertEquals(Collections.emptySet(), status.getAssociatedResources());
  status = provider.getRequestStatus(response, null);
  resource = status.getRequestResource();
  Assert.assertEquals(99L, resource.getPropertyValue("Requests/id"));
  Assert.assertEquals(Collections.emptySet(), status.getAssociatedResources());
  Resource associatedResource = new ResourceImpl(Resource.Type.Service);
  Set<Resource> associatedResources = Collections.singleton(associatedResource);
  status = provider.getRequestStatus(response, associatedResources);
  resource = status.getRequestResource();
  Assert.assertEquals(99L, resource.getPropertyValue("Requests/id"));
  Assert.assertEquals(associatedResources, status.getAssociatedResources());
}