@Test
public void testUpdateAmsEnvContent() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
{

  Method updateAmsEnvContent = UpgradeCatalog221.class.getDeclaredMethod("updateAmsEnvContent", String.class);
  UpgradeCatalog221 upgradeCatalog221 = new UpgradeCatalog221(injector);
  String oldContent = "some_content\n" +
    "# AMS Collector options\n" +
    "export AMS_COLLECTOR_OPTS=\"-Djava.library.path=/usr/lib/ams-hbase/lib/hadoop-native\"\n" +
    "{% if security_enabled %}\n" +
    "export AMS_COLLECTOR_OPTS=\"$AMS_COLLECTOR_OPTS -Djava.security.auth.login.config={{ams_collector_jaas_config_file}} " +
    "-Dzookeeper.sasl.client.username={{zk_servicename}}\"\n" +
    "{% endif %}";
  String expectedContent = "some_content\n" +
    "# AMS Collector options\n" +
    "export AMS_COLLECTOR_OPTS=\"-Djava.library.path=/usr/lib/ams-hbase/lib/hadoop-native\"\n" +
    "{% if security_enabled %}\n" +
    "export AMS_COLLECTOR_OPTS=\"$AMS_COLLECTOR_OPTS -Djava.security.auth.login.config={{ams_collector_jaas_config_file}}\"\n" +
    "{% endif %}";
  String result = (String) updateAmsEnvContent.invoke(upgradeCatalog221, oldContent);
  Assert.assertEquals(expectedContent, result);
}