@Test
  public void testBasicRegionSizeReports() throws Exception {
    final long bytesWritten = 5L * 1024L * 1024L; // 5MB
    final TableName tn = writeData(bytesWritten);
    LOG.debug("Data was written to HBase");
    final Admin admin = TEST_UTIL.getAdmin();
    // Push the data to disk.
    admin.flush(tn);
    LOG.debug("Data flushed to disk");
    // Get the final region distribution
    final List<RegionInfo> regions = TEST_UTIL.getAdmin().getRegions(tn);

    HMaster master = cluster.getMaster();
    MasterQuotaManager quotaManager = master.getMasterQuotaManager();
    Map<RegionInfo, Long> regionSizes = quotaManager.snapshotRegionSizes();
    // Wait until we get all of the region reports for our table
    // The table may split, so make sure we have at least as many as expected right after we
    // finished writing the data.
    int observedRegions = numRegionsForTable(tn, regionSizes);
    while (observedRegions < regions.size()) {
      LOG.debug("Expecting more regions. Saw " + observedRegions
        + " region sizes reported, expected at least " + regions.size());
      Thread.sleep(1000);
      regionSizes = quotaManager.snapshotRegionSizes();
      observedRegions = numRegionsForTable(tn, regionSizes);
    }

    LOG.debug("Observed region sizes by the HMaster: " + regionSizes);
    long totalRegionSize = 0L;
    for (Long regionSize : regionSizes.values()) {
      totalRegionSize += regionSize;
    }
    assertTrue("Expected region size report to exceed " + bytesWritten + ", but was "
      + totalRegionSize + ". RegionSizes=" + regionSizes, bytesWritten < totalRegionSize);
  }
Test class which verifies that region sizes are reported to the master.
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestRegionSizeUse.java