@Test
  public void testIsZooKeeperSecure() throws Exception {
    boolean testJaasConfig =
      ZKAuthentication.isSecureZooKeeper(new Configuration(TEST_UTIL.getConfiguration()));
    assertEquals(testJaasConfig, secureZKAvailable);
    // Define Jaas configuration without ZooKeeper Jaas config
    File saslConfFile = File.createTempFile("tmp", "fakeJaas.conf");
    try (OutputStreamWriter fwriter =
      new OutputStreamWriter(new FileOutputStream(saslConfFile), StandardCharsets.UTF_8)) {
      fwriter.write("");
    }

    System.setProperty("java.security.auth.login.config", saslConfFile.getAbsolutePath());

    testJaasConfig =
      ZKAuthentication.isSecureZooKeeper(new Configuration(TEST_UTIL.getConfiguration()));
    assertFalse(testJaasConfig);
    saslConfFile.delete();
  }
Check if ZooKeeper JaasConfiguration is valid.
hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperACL.java