@Test
public void testGetHostComponents___OR_Predicate_ClusterNotFoundException() throws Exception {

  // member state mocks
  Injector injector = createStrictMock(Injector.class);
  Capture<AmbariManagementController> controllerCapture = EasyMock.newCapture();
  StackId stack = createNiceMock(StackId.class);
  MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
  // requests
  ServiceComponentHostRequest request1 = new ServiceComponentHostRequest(
      "cluster1", null, "component1", "host1", null);
  ServiceComponentHostRequest request2 = new ServiceComponentHostRequest(
      "cluster1", null, "component2", "host2", null);
  ServiceComponentHostRequest request3 = new ServiceComponentHostRequest(
      "cluster1", null, "component3", "host1", null);
  Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>();
  setRequests.add(request1);
  setRequests.add(request2);
  setRequests.add(request3);
  // expectations
  // constructor init
  injector.injectMembers(capture(controllerCapture));
  expect(injector.getInstance(Gson.class)).andReturn(null);
  expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);
  expect(injector.getInstance(KerberosHelper.class)).andReturn(createNiceMock(KerberosHelper.class));
  // getHostComponent
  expect(clusters.getCluster("cluster1")).andThrow(new ClusterNotFoundException("cluster1"));
  // replay mocks
  replay(maintHelper, injector, clusters, stack, ambariMetaInfo);
  //test
  AmbariManagementController controller = new AmbariManagementControllerImpl(null, clusters, injector);
  setAmbariMetaInfo(ambariMetaInfo, controller);
  try {
    controller.getHostComponents(setRequests);
    fail("expected exception");
  } catch (ParentObjectNotFoundException e) {
    //expected
  }
  // assert and verify
  assertSame(controller, controllerCapture.getValue());
  verify(injector, clusters, stack, ambariMetaInfo);
}