private RegionLocator mockRegionLocator(ServerName serverName, List<String> regionNames)
    throws IOException {
    RegionLocator mockedTable = Mockito.mock(RegionLocator.class);
    when(mockedTable.getName()).thenReturn(TableName.valueOf("sizeTestTable"));
    List<HRegionLocation> regionLocations = new ArrayList<>(regionNames.size());
    when(mockedTable.getAllRegionLocations()).thenReturn(regionLocations);

    for (String regionName : regionNames) {
      RegionInfo info = Mockito.mock(RegionInfo.class);
      when(info.getRegionName()).thenReturn(Bytes.toBytes(regionName));
      regionLocations.add(new HRegionLocation(info, serverName));
    }

    return mockedTable;
  }
Makes some table with given region names.
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRegionSizeCalculator.java