@Test
  public void testSplitMerge() throws Exception {
    HBaseTestingUtil util = miniClusterRule.getTestingUtility();
    util.waitTableAvailable(tableName, 30_000);
    AsyncAdmin admin = util.getAsyncConnection().getAdmin();
    admin.split(tableName, Bytes.toBytes(0x10)).get(30, TimeUnit.SECONDS);
    util.waitFor(30_000, new Waiter.ExplainingPredicate<Exception>() {

      @Override
      public boolean evaluate() throws Exception {
        // can potentially observe the parent and both children via this interface.
        return admin.getRegions(tableName)
          .thenApply(val -> val.stream()
            .filter(info -> info.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID).toList())
          .get(30, TimeUnit.SECONDS).size() > 1;
      }

      @Override
      public String explainFailure() {
        return "Split has not finished yet";
      }
    });
    util.waitUntilNoRegionsInTransition();
    List<RegionInfo> regionInfos = admin.getRegions(tableName)
      .thenApply(val -> val.stream()
        .filter(info -> info.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID).toList())
      .get(30, TimeUnit.SECONDS);
    assertEquals(2, regionInfos.size());
    LOG.info("{}", regionInfos);
    admin.mergeRegions(regionInfos.stream().map(RegionInfo::getRegionName).toList(), false).get(30,
      TimeUnit.SECONDS);
    util.waitFor(30000, new Waiter.ExplainingPredicate<Exception>() {

      @Override
      public boolean evaluate() throws Exception {
        // can potentially observe the parent and both children via this interface.
        return admin.getRegions(tableName)
          .thenApply(val -> val.stream()
            .filter(info -> info.getReplicaId() == RegionInfo.DEFAULT_REPLICA_ID).toList())
          .get(30, TimeUnit.SECONDS).size() == 1;
      }

      @Override
      public String explainFailure() {
        return "Merge has not finished yet";
      }
    });
    assertEquals(1, admin.getRegions(tableName).get(30, TimeUnit.SECONDS).size());
  }
Test that we can split and merge the quota table given the presence of various configuration
settings.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestSplitMergeQuotaTable.java