@Test
  public void testIncrementalBackupTableSet() throws IOException {
    TreeSet<TableName> tables1 = new TreeSet<>();

    tables1.add(TableName.valueOf("t1"));
    tables1.add(TableName.valueOf("t2"));
    tables1.add(TableName.valueOf("t3"));

    TreeSet<TableName> tables2 = new TreeSet<>();

    tables2.add(TableName.valueOf("t3"));
    tables2.add(TableName.valueOf("t4"));
    tables2.add(TableName.valueOf("t5"));

    table.addIncrementalBackupTableSet(tables1, "root");

    try (BackupSystemTable systemTable = new BackupSystemTable(conn)) {
      TreeSet<TableName> res1 =
        (TreeSet<TableName>) systemTable.getIncrementalBackupTableSet("root");
      assertTrue(tables1.size() == res1.size());
      Iterator<TableName> desc1 = tables1.descendingIterator();
      Iterator<TableName> desc2 = res1.descendingIterator();
      while (desc1.hasNext()) {
        assertEquals(desc1.next(), desc2.next());
      }
      systemTable.addIncrementalBackupTableSet(tables2, "root");
      TreeSet<TableName> res2 =
        (TreeSet<TableName>) systemTable.getIncrementalBackupTableSet("root");
      assertTrue((tables2.size() + tables1.size() - 1) == res2.size());
      tables1.addAll(tables2);
      desc1 = tables1.descendingIterator();
      desc2 = res2.descendingIterator();
      while (desc1.hasNext()) {
        assertEquals(desc1.next(), desc2.next());
      }
    }

    cleanBackupTable();
  }
Test cases for backup system table API
hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java