}
@SuppressWarnings("unchecked")
@Test
public void testGetConfigGroup() throws Exception {
AmbariManagementController managementController = createMock(AmbariManagementController.class);
Clusters clusters = createNiceMock(Clusters.class);
Cluster cluster = createNiceMock(Cluster.class);
Host h1 = createNiceMock(Host.class);
ConfigGroup configGroup1 = createNiceMock(ConfigGroup.class);
ConfigGroup configGroup2 = createNiceMock(ConfigGroup.class);
ConfigGroup configGroup3 = createNiceMock(ConfigGroup.class);
ConfigGroup configGroup4 = createNiceMock(ConfigGroup.class);
ConfigGroupResponse response1 = createNiceMock(ConfigGroupResponse.class);
ConfigGroupResponse response2 = createNiceMock(ConfigGroupResponse.class);
ConfigGroupResponse response3 = createNiceMock(ConfigGroupResponse.class);
ConfigGroupResponse response4 = createNiceMock(ConfigGroupResponse.class);
Map<Long, ConfigGroup> configGroupMap = new HashMap<Long, ConfigGroup>();
configGroupMap.put(1L, configGroup1);
configGroupMap.put(2L, configGroup2);
configGroupMap.put(3L, configGroup3);
configGroupMap.put(4L, configGroup4);
Map<Long, ConfigGroup> configGroupByHostname = new HashMap<Long, ConfigGroup>();
configGroupByHostname.put(4L, configGroup4);
expect(configGroup1.convertToResponse()).andReturn(response1).anyTimes();
expect(configGroup2.convertToResponse()).andReturn(response2).anyTimes();
expect(configGroup3.convertToResponse()).andReturn(response3).anyTimes();
expect(configGroup4.convertToResponse()).andReturn(response4).anyTimes();
expect(managementController.getClusters()).andReturn(clusters).anyTimes();
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
expect(cluster.getConfigGroups()).andReturn(configGroupMap).anyTimes();
expect(configGroup1.getName()).andReturn("g1").anyTimes();
expect(configGroup2.getName()).andReturn("g2").anyTimes();