@Test
public void testUpdateHBaseAdnClusterConfigs() throws Exception {

  setupIoCContext();
  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 Map<String, String> propertiesHbaseSite = new HashMap<String, String>() {
    {
      put("hbase.bucketcache.size", "1024m");
    }
  };
  final Map<String, String> propertiesHbaseEnv = new HashMap<String, String>() {
    {
      put("override_hbase_uid", "false");
    }
  };
  final Config mockHbaseEnv = easyMockSupport.createNiceMock(Config.class);
  expect(mockHbaseEnv.getProperties()).andReturn(propertiesHbaseEnv).once();
  final Config mockHbaseSite = easyMockSupport.createNiceMock(Config.class);
  expect(mockHbaseSite.getProperties()).andReturn(propertiesHbaseSite).once();
  final Config mockClusterEnv = easyMockSupport.createNiceMock(Config.class);
  final Map<String, String> propertiesExpectedHbaseEnv = new HashMap<String, String>();
  final Map<String, String> propertiesExpectedClusterEnv = new HashMap<String, String>() {{
    put("override_uid", "false");
  }};
  final Map<String, String> propertiesExpectedHbaseSite = new HashMap<String, String>() {{
    put("hbase.bucketcache.size", "1024");
  }};
  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(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();
  expect(mockClusterExpected.getDesiredConfigByType("cluster-env")).andReturn(mockClusterEnv).atLeastOnce();
  expect(mockClusterExpected.getDesiredConfigByType("hbase-env")).andReturn(mockHbaseEnv).atLeastOnce();
  expect(mockClusterExpected.getDesiredConfigByType("hbase-site")).andReturn(mockHbaseSite).atLeastOnce();
  expect(mockClusterEnv.getProperties()).andReturn(propertiesExpectedClusterEnv).atLeastOnce();
  expect(mockHbaseEnv.getProperties()).andReturn(propertiesExpectedHbaseEnv).atLeastOnce();
  expect(mockHbaseSite.getProperties()).andReturn(propertiesExpectedHbaseSite).atLeastOnce();
  easyMockSupport.replayAll();
  mockInjector.getInstance(UpgradeCatalog212.class).updateHbaseAndClusterConfigurations();
  easyMockSupport.verifyAll();
}