static PrivilegedExceptionAction<Void> getScanSnapshotAction(Configuration conf,
    String snapshotName, long expectedRowCount) {
    return () -> {
      try {
        Path restoreDir = new Path(SnapshotScannerHDFSAclHelper.SNAPSHOT_RESTORE_TMP_DIR_DEFAULT);
        Scan scan = new Scan();
        TableSnapshotScanner scanner =
          new TableSnapshotScanner(conf, restoreDir, snapshotName, scan);
        int rowCount = 0;
        while (true) {
          Result result = scanner.next();
          if (result == null) {
            break;
          }
          rowCount++;
        }
        scanner.close();
        assertEquals(expectedRowCount, rowCount);
      } catch (Exception e) {
        LOG.debug("Scan snapshot error, snapshot {}", snapshotName, e);
        assertEquals(expectedRowCount, -1);
      }
      return null;
    };
  }
Check if user is able to read expected rows from the specific snapshot
@param user             the specific user
@param snapshot         the snapshot to be scanned
@param expectedRowCount expected row count read from snapshot, -1 if expects
                        AccessControlException
@throws IOException          user scan snapshot error
@throws InterruptedException user scan snapshot error
hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestHDFSAclHelper.java