@Test
  public void testSnapshotFailsOnNonExistantTable() throws Exception {
    Admin admin = UTIL.getAdmin();
    // make sure we don't fail on listing snapshots
    SnapshotTestingUtils.assertNoSnapshots(admin);
    String tableName = "_not_a_table";

    // make sure the table doesn't exist
    boolean fail = false;
    do {
      try {
        admin.getDescriptor(TableName.valueOf(tableName));
        fail = true;
        LOG.error("Table:" + tableName + " already exists, checking a new name");
        tableName = tableName + "!";
      } catch (TableNotFoundException e) {
        fail = false;
      }
    } while (fail);

    // snapshot the non-existant table
    try {
      admin.snapshot("fail", TableName.valueOf(tableName));
      fail("Snapshot succeeded even though there is not table.");
    } catch (SnapshotCreationException e) {
      LOG.info("Correctly failed to snapshot a non-existant table:" + e.getMessage());
    }
  }
Test snapshotting a table that is offline
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromClient.java