private int getTableSize(TableName tn, Map<RegionInfo, Long> regionSizes) {
    int tableSize = 0;
    for (Entry<RegionInfo, Long> entry : regionSizes.entrySet()) {
      RegionInfo regionInfo = entry.getKey();
      long regionSize = entry.getValue();
      if (tn.equals(regionInfo.getTable())) {
        tableSize += regionSize;
      }
    }
    return tableSize;
  }
Test class for the quota status RPCs in the master and regionserver.
hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestQuotaStatusRPCs.java