private PairOfSameType<RegionInfo> requestMergeRegion(HMaster master, TableName tablename,
    int regionAnum, int regionBnum) throws Exception {
    List<Pair<RegionInfo, ServerName>> tableRegions =
      MetaTableAccessor.getTableRegionsAndLocations(TEST_UTIL.getConnection(), tablename);
    RegionInfo regionA = tableRegions.get(regionAnum).getFirst();
    RegionInfo regionB = tableRegions.get(regionBnum).getFirst();
    ADMIN.mergeRegionsAsync(regionA.getEncodedNameAsBytes(), regionB.getEncodedNameAsBytes(),
      false);
    return new PairOfSameType<>(regionA, regionB);
  }
This test tests 1, merging region not online; 2, merging same two regions; 3, merging unknown
regions. They are in one test case so that we don't have to create many tables, and these tests
are simple.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java