RequestStatusResponse response = createNiceMock(RequestStatusResponse.class);
Clusters clusters = createNiceMock(Clusters.class);
Cluster cluster = createNiceMock(Cluster.class);
Host h1 = createNiceMock(Host.class);
Host h2 = createNiceMock(Host.class);
ConfigGroupFactory configGroupFactory = createNiceMock(ConfigGroupFactory.class);
ConfigGroup configGroup = createNiceMock(ConfigGroup.class);
expect(managementController.getClusters()).andReturn(clusters);
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
expect(clusters.getHost("h1")).andReturn(h1);
expect(clusters.getHost("h2")).andReturn(h2);
expect(managementController.getConfigGroupFactory()).andReturn(configGroupFactory);
expect(managementController.getAuthName()).andReturn("admin").anyTimes();
Capture<Cluster> clusterCapture = new Capture<Cluster>();
Capture<String> captureName = new Capture<String>();
Capture<String> captureDesc = new Capture<String>();
Capture<String> captureTag = new Capture<String>();
Capture<Map<String, Config>> captureConfigs = new Capture<Map<String,
Config>>();
Capture<Map<String, Host>> captureHosts = new Capture<Map<String, Host>>();
expect(configGroupFactory.createNew(capture(clusterCapture),
capture(captureName), capture(captureTag), capture(captureDesc),
capture(captureConfigs), capture(captureHosts))).andReturn(configGroup);
replay(managementController, clusters, cluster, configGroupFactory,
configGroup, response);