@Test
  public void testNumRegionsForTable() {
    TableName tn1 = TableName.valueOf("t1");
    TableName tn2 = TableName.valueOf("t2");
    TableName tn3 = TableName.valueOf("t3");

    final int numTable1Regions = 10;
    final int numTable2Regions = 15;
    final int numTable3Regions = 8;
    Map<RegionInfo, Long> regionReports = new HashMap<>();
    for (int i = 0; i < numTable1Regions; i++) {
      regionReports.put(RegionInfoBuilder.newBuilder(tn1).setStartKey(Bytes.toBytes(i))
        .setEndKey(Bytes.toBytes(i + 1)).build(), 0L);
    }

    for (int i = 0; i < numTable2Regions; i++) {
      regionReports.put(RegionInfoBuilder.newBuilder(tn2).setStartKey(Bytes.toBytes(i))
        .setEndKey(Bytes.toBytes(i + 1)).build(), 0L);
    }

    for (int i = 0; i < numTable3Regions; i++) {
      regionReports.put(RegionInfoBuilder.newBuilder(tn3).setStartKey(Bytes.toBytes(i))
        .setEndKey(Bytes.toBytes(i + 1)).build(), 0L);
    }

    TableQuotaSnapshotStore store = new TableQuotaSnapshotStore(conn, chore, regionReports);
    when(chore.getTableSnapshotStore()).thenReturn(store);

    assertEquals(numTable1Regions, Iterables.size(store.filterBySubject(tn1)));
    assertEquals(numTable2Regions, Iterables.size(store.filterBySubject(tn2)));
    assertEquals(numTable3Regions, Iterables.size(store.filterBySubject(tn3)));
  }
Non-HBase cluster unit tests for {@link QuotaObserverChore}.
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaObserverChore.java