@Test
  public void testImmutableGetters() {
    Set<TableName> tablesWithTableQuotas = new HashSet<>();
    Set<TableName> tablesWithNamespaceQuotas = new HashSet<>();
    final TablesWithQuotas tables = new TablesWithQuotas(conn, conf);
    for (int i = 0; i < 5; i++) {
      TableName tn = TableName.valueOf("tn" + i);
      tablesWithTableQuotas.add(tn);
      tables.addTableQuotaTable(tn);
    }
    for (int i = 0; i < 3; i++) {
      TableName tn = TableName.valueOf("tn_ns" + i);
      tablesWithNamespaceQuotas.add(tn);
      tables.addNamespaceQuotaTable(tn);
    }
    Set<TableName> actualTableQuotaTables = tables.getTableQuotaTables();
    Set<TableName> actualNamespaceQuotaTables = tables.getNamespaceQuotaTables();
    assertEquals(tablesWithTableQuotas, actualTableQuotaTables);
    assertEquals(tablesWithNamespaceQuotas, actualNamespaceQuotaTables);
    try {
      actualTableQuotaTables.add(null);
      fail("Should not be able to add an element");
    } catch (UnsupportedOperationException e) {
      // pass
    }
    try {
      actualNamespaceQuotaTables.add(null);
      fail("Should not be able to add an element");
    } catch (UnsupportedOperationException e) {
      // pass
    }
  }
Non-HBase cluster unit tests for {@link TablesWithQuotas}.
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestTablesWithQuotas.java