@Test(expected = AmbariException.class)
public void testNoCandidateHostThrowsException() throws Exception {

  long clusterId = clusters.getCluster("c1").getClusterId();
  // put host into MM
  clusters.getHost("c6402").setMaintenanceState(clusterId, MaintenanceState.ON);
  // ensure that service check is added for ZOOKEEPER
  injector.getInstance(ActionMetadata.class).addServiceCheckAction("ZOOKEEPER");
  Map<String, String> requestProperties = new HashMap<String, String>() {
    {
      put("context", "Service Check ZooKeeper");
      put("operation_level/level", "SERVICE");
      put("operation_level/service_name", "ZOOKEEPER");
      put("operation_level/cluster_name", "c1");
    }
  };
  // create the service check on the host in MM
  ExecuteActionRequest actionRequest = new ExecuteActionRequest("c1",
      "ZOOKEEPER_QUORUM_SERVICE_CHECK",
      null, Collections.singletonList(new RequestResourceFilter("ZOOKEEPER", "ZOOKEEPER_CLIENT",
      Collections.singletonList("c6402"))),
      new RequestOperationLevel(Resource.Type.Service, "c1", "ZOOKEEPER", null, null),
      new HashMap<String, String>(), false);
  EasyMock.replay(hostRoleCommand, actionManager, configHelper);
  ambariManagementController.createAction(actionRequest, requestProperties);
  Assert.fail(
      "Expected an exception since there are no hosts which can run the ZK service check");
}