@Test
public void testUpdateAmsHbaseSecuritySiteConfigs() throws Exception{

  Map<String, String> oldPropertiesAmsHbaseSecuritySite = new HashMap<String, String>() {
    {
      put("zookeeper.znode.parent", "/ams-hbase-secure");
    }
  };
  Map<String, String> newPropertiesAmsHbaseSecuritySite = new HashMap<>();
  EasyMockSupport easyMockSupport = new EasyMockSupport();
  Clusters clusters = easyMockSupport.createNiceMock(Clusters.class);
  final Cluster cluster = easyMockSupport.createNiceMock(Cluster.class);
  Config mockAmsHbaseSecuritySite = easyMockSupport.createNiceMock(Config.class);
  expect(clusters.getClusters()).andReturn(new HashMap<String, Cluster>() {{
    put("normal", cluster);
  }}).once();
  expect(cluster.getDesiredConfigByType("ams-hbase-security-site")).andReturn(mockAmsHbaseSecuritySite).atLeastOnce();
  expect(mockAmsHbaseSecuritySite.getProperties()).andReturn(oldPropertiesAmsHbaseSecuritySite).times(2);
  Injector injector = easyMockSupport.createNiceMock(Injector.class);
  expect(injector.getInstance(Gson.class)).andReturn(null).anyTimes();
  expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(null).anyTimes();
  expect(injector.getInstance(KerberosHelper.class)).andReturn(createNiceMock(KerberosHelper.class)).anyTimes();
  replay(injector, clusters, mockAmsHbaseSecuritySite, cluster);
  AmbariManagementControllerImpl controller = createMockBuilder(AmbariManagementControllerImpl.class)
    .addMockedMethod("createConfiguration")
    .addMockedMethod("getClusters", new Class[] { })
    .addMockedMethod("createConfig")
    .withConstructor(createNiceMock(ActionManager.class), clusters, injector)
    .createNiceMock();
  Injector injector2 = easyMockSupport.createNiceMock(Injector.class);
  Capture<Map<String, String>> propertiesCapture = EasyMock.newCapture();
  expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
  expect(controller.getClusters()).andReturn(clusters).anyTimes();
  expect(controller.createConfig(anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
    EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
  replay(controller, injector2);
  new UpgradeCatalog221(injector2).updateAMSConfigs();
  easyMockSupport.verifyAll();
  Map<String, String> updatedProperties = propertiesCapture.getValue();
  assertTrue(Maps.difference(newPropertiesAmsHbaseSecuritySite, updatedProperties).areEqual());
}