@BeforeClass
  public static void beforeAllTests() throws Exception {
    TEST_UTIL.startMiniCluster(2);
    // Create a table of three families. This will assign a region.
    TEST_UTIL.createMultiRegionTable(TABLENAME, FAMILIES);
    Table t = TEST_UTIL.getConnection().getTable(TABLENAME);
    int countOfRegions = -1;
    try (RegionLocator r = TEST_UTIL.getConnection().getRegionLocator(TABLENAME)) {
      countOfRegions = r.getStartKeys().length;
    }
    TEST_UTIL.waitUntilAllRegionsAssigned(TABLENAME);
    addToEachStartKey(countOfRegions);
    t.close();
  }
Start up a mini cluster and put a small table of many empty regions into it.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java