@Test
  public void testExportExpiredSnapshot() throws Exception {
    String name = "testExportExpiredSnapshot";
    TableName tableName = TableName.valueOf(name);
    String snapshotName = "snapshot-" + name;
    createTable(tableName);
    SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 50, FAMILY);
    Map<String, Object> properties = new HashMap<>();
    properties.put("TTL", 10);
    org.apache.hadoop.hbase.client.SnapshotDescription snapshotDescription =
      new org.apache.hadoop.hbase.client.SnapshotDescription(snapshotName, tableName,
        SnapshotType.FLUSH, null, EnvironmentEdgeManager.currentTime(), -1, properties);
    admin.snapshot(snapshotDescription);
    boolean isExist =
      admin.listSnapshots().stream().anyMatch(ele -> snapshotName.equals(ele.getName()));
    assertTrue(isExist);
    int retry = 6;
    while (
      !SnapshotDescriptionUtils.isExpiredSnapshot(snapshotDescription.getTtl(),
        snapshotDescription.getCreationTime(), EnvironmentEdgeManager.currentTime()) && retry > 0
    ) {
      retry--;
      Thread.sleep(10 * 1000);
    }
    boolean isExpiredSnapshot =
      SnapshotDescriptionUtils.isExpiredSnapshot(snapshotDescription.getTtl(),
        snapshotDescription.getCreationTime(), EnvironmentEdgeManager.currentTime());
    assertTrue(isExpiredSnapshot);
    int res = runExportSnapshot(TEST_UTIL.getConfiguration(), snapshotName, snapshotName,
      TEST_UTIL.getDefaultRootDirPath(), getHdfsDestinationDir(), false, false, false, true, true);
    assertTrue(res == AbstractHBaseTool.EXIT_FAILURE);
  }
Verify if exported snapshot and copied files matches the original one.
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java