@Test
  public void testKerberosEnabledTest() throws Exception {
    Map<String, ServiceInfo> serviceInfoMap;
    ServiceInfo service;

    String kerberosEnabledTest =
        "{\n" +
            "  \"or\": [\n" +
            "    {\n" +
            "      \"equals\": [\n" +
            "        \"core-site/hadoop.security.authentication\",\n" +
            "        \"kerberos\"\n" +
            "      ]\n" +
            "    },\n" +
            "    {\n" +
            "      \"equals\": [\n" +
            "        \"hdfs-site/hadoop.security.authentication\",\n" +
            "        \"kerberos\"\n" +
            "      ]\n" +
            "    }\n" +
            "  ]\n" +
            "}";

    String serviceInfoXml = "<metainfo>\n" +
        "  <schemaVersion>2.0</schemaVersion>\n" +
        "  <services>\n" +
        "    <service>\n" +
        "      <name>HDFS</name>\n" +
        "      <kerberosEnabledTest>\n" +
        kerberosEnabledTest +
        "      </kerberosEnabledTest>\n" +
        "    </service>\n" +
        "  </services>\n" +
        "</metainfo>\n";
    serviceInfoMap = getServiceInfo(serviceInfoXml);
    service = serviceInfoMap.get("HDFS");
    assertEquals(kerberosEnabledTest, service.getKerberosEnabledTest().trim());

    /*
     * <kerberosEnabledTest> is missing
     */
    serviceInfoXml = "<metainfo>\n" +
        "  <schemaVersion>2.0</schemaVersion>\n" +
        "  <services>\n" +
        "    <service>\n" +
        "      <name>HDFS</name>\n" +
        "    </service>\n" +
        "  </services>\n" +
        "</metainfo>\n";
    serviceInfoMap = getServiceInfo(serviceInfoXml);
    service = serviceInfoMap.get("HDFS");
    assertNull(service.getKerberosEnabledTest());
  }
Tests the presence and absence of the kerberosEnabledTest block.
ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java