@Test
  public void testListTableSnapshots() throws Exception {
    Admin admin = null;
    final TableName tableName = name.getTableName();
    try {
      admin = UTIL.getAdmin();

      TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName).build();
      UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration());

      String table1Snapshot1 = "Table1Snapshot1";
      admin.snapshot(table1Snapshot1, TABLE_NAME);
      LOG.debug("Snapshot1 completed.");

      String table1Snapshot2 = "Table1Snapshot2";
      admin.snapshot(table1Snapshot2, TABLE_NAME);
      LOG.debug("Snapshot2 completed.");

      String table2Snapshot1 = "Table2Snapshot1";
      admin.snapshot(table2Snapshot1, tableName);
      LOG.debug(table2Snapshot1 + " completed.");

      List<SnapshotDescription> listTableSnapshots =
        admin.listTableSnapshots(Pattern.compile("test.*"), MATCH_ALL);
      List<String> listTableSnapshotNames = new ArrayList<>();
      assertEquals(3, listTableSnapshots.size());
      for (SnapshotDescription s : listTableSnapshots) {
        listTableSnapshotNames.add(s.getName());
      }
      assertTrue(listTableSnapshotNames.contains(table1Snapshot1));
      assertTrue(listTableSnapshotNames.contains(table1Snapshot2));
      assertTrue(listTableSnapshotNames.contains(table2Snapshot1));
    } finally {
      if (admin != null) {
        try {
          admin.deleteSnapshots(Pattern.compile("Table.*"));
        } catch (SnapshotDoesNotExistException ignore) {
        }
        if (admin.tableExists(tableName)) {
          UTIL.deleteTable(tableName);
        }
        admin.close();
      }
    }
  }
Test snapshotting a table that is offline
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromClient.java