@Test
public void testHdfsSiteUpdateConfigs2() throws Exception{

  Map<String, String> oldPropertiesHdfsSite = new HashMap<String, String>() {
    {
      put("dfs.client.retry.policy.enabled", "true");
    }
  };
  Map<String, String> newPropertiesHdfsSite = new HashMap<String, String>() {
    {
      put("dfs.client.retry.policy.enabled", "false");
    }
  };
  EasyMockSupport easyMockSupport = new EasyMockSupport();
  Clusters clusters = easyMockSupport.createNiceMock(Clusters.class);
  final Cluster cluster = easyMockSupport.createNiceMock(Cluster.class);
  final Service service = createStrictMock(Service.class);
  final Map<String, Service> services = Collections.singletonMap("HDFS", service);
  Config mockHdfsSite = easyMockSupport.createNiceMock(Config.class);
  expect(clusters.getClusters()).andReturn(new HashMap<String, Cluster>() {{
    put("normal", cluster);
  }}).anyTimes();
  expect(cluster.getDesiredConfigByType("hdfs-site")).andReturn(mockHdfsSite).atLeastOnce();
  expect(mockHdfsSite.getProperties()).andReturn(oldPropertiesHdfsSite).anyTimes();
  expect(cluster.getServices()).andReturn(services).once();
  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, mockHdfsSite, 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 UpgradeCatalog240(injector2).updateHDFSConfigs();
  easyMockSupport.verifyAll();
  Map<String, String> updatedProperties = propertiesCapture.getValue();
  assertTrue(Maps.difference(newPropertiesHdfsSite, updatedProperties).areEqual());
}