@Test
  public void testGetClusters___ClusterNotFoundException() throws Exception {
    // member state mocks
    Injector injector = createStrictMock(Injector.class);
    Capture<AmbariManagementController> controllerCapture = EasyMock.newCapture();

    // requests
    ClusterRequest request1 = new ClusterRequest(null, "cluster1", "1", Collections.emptySet());

    Set<ClusterRequest> setRequests = new HashSet<>();
    setRequests.add(request1);

    // expectations
    // constructor init
    constructorInit(injector, controllerCapture, createNiceMock(KerberosHelper.class));

    // getCluster
    expect(clusters.getCluster("cluster1")).andThrow(new ClusterNotFoundException("cluster1"));

    // replay mocks
    replay(injector, clusters);

    //test
    AmbariManagementController controller = new AmbariManagementControllerImpl(null, clusters, injector);

    // assert that exception is thrown in case where there is a single request
    try {
      controller.getClusters(setRequests);
      fail("expected ClusterNotFoundException");
    } catch (ClusterNotFoundException e) {
      // expected
    }

    verify(injector, clusters);
  }
Ensure that ClusterNotFoundException is propagated in case where there is a single request.
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java