@Test
  public void testGetTablesByNamespace() {
    final TablesWithQuotas tables = new TablesWithQuotas(conn, conf);
    tables.addTableQuotaTable(TableName.valueOf("ignored1"));
    tables.addTableQuotaTable(TableName.valueOf("ignored2"));
    tables.addNamespaceQuotaTable(TableName.valueOf("ns1", "t1"));
    tables.addNamespaceQuotaTable(TableName.valueOf("ns1", "t2"));
    tables.addNamespaceQuotaTable(TableName.valueOf("ns1", "t3"));
    tables.addNamespaceQuotaTable(TableName.valueOf("ns2", "t1"));
    tables.addNamespaceQuotaTable(TableName.valueOf("ns2", "t2"));

    Multimap<String, TableName> tablesByNamespace = tables.getTablesByNamespace();
    Collection<TableName> tablesInNs = tablesByNamespace.get("ns1");
    assertEquals(3, tablesInNs.size());
    assertTrue("Unexpected results for ns1: " + tablesInNs,
      tablesInNs.containsAll(Arrays.asList(TableName.valueOf("ns1", "t1"),
        TableName.valueOf("ns1", "t2"), TableName.valueOf("ns1", "t3"))));
    tablesInNs = tablesByNamespace.get("ns2");
    assertEquals(2, tablesInNs.size());
    assertTrue("Unexpected results for ns2: " + tablesInNs, tablesInNs
      .containsAll(Arrays.asList(TableName.valueOf("ns2", "t1"), TableName.valueOf("ns2", "t2"))));
  }
Non-HBase cluster unit tests for {@link TablesWithQuotas}.
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestTablesWithQuotas.java