@Test
public void testUpdateAuthToLocalRules() throws AmbariException {

  KerberosDescriptor oldValue = KERBEROS_DESCRIPTOR_FACTORY.createInstance(
      "{\n" +
          "  \"auth_to_local_properties\" : [\n" +
          "    \"core-site/hadoop.security.auth_to_local\",\n" +
          "    \"some-site/to.be.removed\"\n" +
          "  ]\n" +
          "}\n");
  KerberosDescriptor newValue = KERBEROS_DESCRIPTOR_FACTORY.createInstance(
      "{\n" +
          "  \"auth_to_local_properties\" : [\n" +
          "    \"core-site/hadoop.security.auth_to_local\",\n" +
          "    \"some-site/to.be.added\"\n" +
          "  ]\n" +
          "}\n");
  KerberosDescriptor userValue = KERBEROS_DESCRIPTOR_FACTORY.createInstance(
      "{\n" +
          "  \"auth_to_local_properties\" : [\n" +
          "    \"core-site/hadoop.security.auth_to_local\",\n" +
          "    \"some-site/added.by.user\"\n" +
          "  ]\n" +
          "}\n");
  KerberosDescriptor updatedUserValue = KerberosDescriptorUpdateHelper.updateUserKerberosDescriptor(
      oldValue,
      newValue,
      userValue);
  Assert.assertEquals(
      KERBEROS_DESCRIPTOR_FACTORY.createInstance(
          "{\n" +
              "  \"auth_to_local_properties\" : [\n" +
              "    \"core-site/hadoop.security.auth_to_local\",\n" +
              "    \"some-site/to.be.added\",\n" +
              "    \"some-site/added.by.user\"\n" +
              "  ]\n" +
              "}\n"),
      updatedUserValue);
}