@Test
  public void testFilteringMissingTables() throws Exception {
    final TableName missingTable = TableName.valueOf("doesNotExist");
    // Set up Admin to return null (match the implementation)
    Admin admin = mock(Admin.class);
    when(conn.getAdmin()).thenReturn(admin);
    when(admin.getRegions(missingTable)).thenReturn(null);

    QuotaObserverChore chore = mock(QuotaObserverChore.class);
    Map<RegionInfo, Long> regionUsage = new HashMap<>();
    TableQuotaSnapshotStore store = new TableQuotaSnapshotStore(conn, chore, regionUsage);

    // A super dirty hack to verify that, after getting no regions for our table,
    // we bail out and start processing the next element (which there is none).
    final TablesWithQuotas tables = new TablesWithQuotas(conn, conf) {
      @Override
      int getNumReportedRegions(TableName table, QuotaSnapshotStore<TableName> tableStore) {
        throw new RuntimeException("Should should not reach here");
      }
    };
    tables.addTableQuotaTable(missingTable);

    tables.filterInsufficientlyReportedTables(store);

    final Set<TableName> tablesWithQuotas = tables.getTableQuotaTables();
    assertTrue("Expected to find no tables, but found " + tablesWithQuotas,
      tablesWithQuotas.isEmpty());
  }
Non-HBase cluster unit tests for {@link TablesWithQuotas}.
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestTablesWithQuotas.java