@Test
  public void testClearHadoopMetrics2Content() throws Exception {

    Map<String, String> oldContentProperty = new HashMap<String, String>() {
      {
        put("content", "# Licensed to the Apache Software Foundation (ASF) under one or more...");
      }
    };
    Map<String, String> newContentProperty = new HashMap<String, String>() {
      {
        put("content", "");
      }
    };

    EasyMockSupport easyMockSupport = new EasyMockSupport();

    Clusters clusters = easyMockSupport.createNiceMock(Clusters.class);
    final Cluster cluster = easyMockSupport.createNiceMock(Cluster.class);
    Config mockHadoopMetrics2Properties = easyMockSupport.createNiceMock(Config.class);

    expect(clusters.getClusters()).andReturn(new HashMap<String, Cluster>() {{
      put("normal", cluster);
    }}).once();
    expect(cluster.getDesiredConfigByType("hadoop-metrics2.properties")).andReturn(mockHadoopMetrics2Properties).atLeastOnce();
    expect(mockHadoopMetrics2Properties.getProperties()).andReturn(oldContentProperty).anyTimes();

    Injector injector = easyMockSupport.createNiceMock(Injector.class);

    replay(injector, clusters, mockHadoopMetrics2Properties, cluster);

    AmbariManagementControllerImpl controller = createMockBuilder(AmbariManagementControllerImpl.class)
        .addMockedMethod("getClusters", new Class[] { })
        .addMockedMethod("createConfig", Cluster.class, StackId.class, String.class, Map.class,
            String.class, Map.class)
        .withConstructor(createNiceMock(ActionManager.class), clusters, injector)
        .createNiceMock();

    Injector injector2 = easyMockSupport.createNiceMock(Injector.class);
    Capture<Map> propertiesCapture = EasyMock.newCapture();

    expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
    expect(controller.getClusters()).andReturn(clusters).anyTimes();
    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
        anyObject(Map.class))).andReturn(createNiceMock(Config.class)).once();

    replay(controller, injector2);
    new UpgradeCatalog270(injector2).clearHadoopMetrics2Content();
    easyMockSupport.verifyAll();

    Map<String, String> updatedProperties = propertiesCapture.getValue();
    assertTrue(Maps.difference(newContentProperty, updatedProperties).areEqual());

  }
@return sample JSON data from repo_version data (no repositories defined) where 'OperatingSystems/ambari_managed_repositories' is missing
ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog270Test.java