@Test
public void testUpdateHDFSConfiguration() throws Exception {

  EasyMockSupport easyMockSupport = new EasyMockSupport();
  final AmbariManagementController mockAmbariManagementController = easyMockSupport.createNiceMock(AmbariManagementController.class);
  final ConfigHelper mockConfigHelper = easyMockSupport.createMock(ConfigHelper.class);
  final Clusters mockClusters = easyMockSupport.createStrictMock(Clusters.class);
  final Cluster mockClusterExpected = easyMockSupport.createNiceMock(Cluster.class);
  final Config mockHdfsSite = easyMockSupport.createNiceMock(Config.class);
  final Map<String, String> propertiesExpectedHdfs = new HashMap<String, String>();
  propertiesExpectedHdfs.put("dfs.namenode.rpc-address", "nn.rpc.address");
  propertiesExpectedHdfs.put("dfs.nameservices", "nn1");
  propertiesExpectedHdfs.put("dfs.ha.namenodes.nn1", "value");
  final Injector mockInjector = Guice.createInjector(new AbstractModule() {
    @Override
    protected void configure() {
      bind(AmbariManagementController.class).toInstance(mockAmbariManagementController);
      bind(ConfigHelper.class).toInstance(mockConfigHelper);
      bind(Clusters.class).toInstance(mockClusters);
      bind(EntityManager.class).toInstance(entityManager);
      bind(DBAccessor.class).toInstance(createNiceMock(DBAccessor.class));
      bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
    }
  });
  expect(mockAmbariManagementController.getClusters()).andReturn(mockClusters).once();
  expect(mockClusters.getClusters()).andReturn(new HashMap<String, Cluster>() {{
    put("normal", mockClusterExpected);
  }}).once();
  // Expected operation
  expect(mockClusterExpected.getDesiredConfigByType("hdfs-site")).andReturn(mockHdfsSite).atLeastOnce();
  expect(mockHdfsSite.getProperties()).andReturn(propertiesExpectedHdfs).anyTimes();
  easyMockSupport.replayAll();
  mockInjector.getInstance(UpgradeCatalog220.class).updateHDFSConfigs();
  easyMockSupport.verifyAll();
}