@Test
  public void testPersistence() throws Exception {
    Configuration conf = UTIL.getConfiguration();
    try (Connection connection = ConnectionFactory.createConnection(conf)) {
      addUserPermission(conf,
        new UserPermission("albert",
          Permission.newBuilder(TEST_TABLE).withActions(Permission.Action.READ).build()),
        connection.getTable(PermissionStorage.ACL_TABLE_NAME));
      addUserPermission(conf,
        new UserPermission("betty",
          Permission.newBuilder(TEST_TABLE)
            .withActions(Permission.Action.READ, Permission.Action.WRITE).build()),
        connection.getTable(PermissionStorage.ACL_TABLE_NAME));
      addUserPermission(conf,
        new UserPermission("clark",
          Permission.newBuilder(TEST_TABLE).withFamily(TEST_FAMILY)
            .withActions(Permission.Action.READ).build()),
        connection.getTable(PermissionStorage.ACL_TABLE_NAME));
      addUserPermission(conf,
        new UserPermission("dwight",
          Permission.newBuilder(TEST_TABLE).withFamily(TEST_FAMILY).withQualifier(TEST_QUALIFIER)
            .withActions(Permission.Action.WRITE).build()),
        connection.getTable(PermissionStorage.ACL_TABLE_NAME));
    }
    // verify permissions survive changes in table metadata
    ListMultimap<String, UserPermission> preperms =
      PermissionStorage.getTablePermissions(conf, TEST_TABLE);

    Table table = UTIL.getConnection().getTable(TEST_TABLE);
    table.put(
      new Put(Bytes.toBytes("row1")).addColumn(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes("v1")));
    table.put(
      new Put(Bytes.toBytes("row2")).addColumn(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes("v2")));
    Admin admin = UTIL.getAdmin();
    try {
      admin.split(TEST_TABLE);
    } catch (IOException e) {
      // although split fail, this may not affect following check
      // In old Split API without AM2, if region's best split key is not found,
      // there are not exception thrown. But in current API, exception
      // will be thrown.
      LOG.debug("region is not splittable, because " + e);
    }

    // wait for split
    Thread.sleep(10000);

    ListMultimap<String, UserPermission> postperms =
      PermissionStorage.getTablePermissions(conf, TEST_TABLE);

    checkMultimapEqual(preperms, postperms);
  }
The PermissionStorage.addUserPermission may throw exception before closing the table.
hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestTablePermissions.java