private static RegionMetrics createMockRegionMetrics(RegionInfo regionInfo) {
    RegionMetrics regionMetrics = Mockito.mock(RegionMetrics.class);

    // Important
    int storeFileSizeMb = REGION_TO_STORE_FILE_SIZE_MB.get(regionInfo.getRegionId());
    when(regionMetrics.getRegionSizeMB()).thenReturn(new Size(storeFileSizeMb, Size.Unit.MEGABYTE));
    when(regionMetrics.getStoreFileSize())
      .thenReturn(new Size(storeFileSizeMb, Size.Unit.MEGABYTE));

    // Not important
    when(regionMetrics.getReadRequestCount()).thenReturn(0L);
    when(regionMetrics.getCpRequestCount()).thenReturn(0L);
    when(regionMetrics.getWriteRequestCount()).thenReturn(0L);
    when(regionMetrics.getMemStoreSize()).thenReturn(new Size(0, Size.Unit.MEGABYTE));
    when(regionMetrics.getCurrentRegionCachedRatio()).thenReturn(0.0f);
    return regionMetrics;
  }
Creates a mocked RegionMetrics for the given region.
hbase-balancer/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStoreFileTableSkewCostFunction.java