private static int createTableTargetOfSplitAndMerge(final TableName tableName) throws Exception {
    final int[] regionSizesMb = { 10, 0, 2, 2 };
    final List<HRegion> generatedRegions = generateTestData(tableName, regionSizesMb);
    assertEquals(4, getRegionCount(tableName));
    admin.flush(tableName).get();

    final TableDescriptor td = TableDescriptorBuilder
      .newBuilder(admin.getDescriptor(tableName).get()).setNormalizationEnabled(true).build();
    admin.modifyTable(td).get();

    // make sure relatively accurate region statistics are available for the test table. use
    // the last/largest region as clue.
    LOG.debug("waiting for region statistics to settle.");
    TEST_UTIL.waitFor(TimeUnit.MINUTES.toMillis(5), new ExplainingPredicate<IOException>() {
      @Override
      public String explainFailure() {
        return "expected largest region to be >= 10mb.";
      }

      @Override
      public boolean evaluate() {
        for (int i = 0; i < generatedRegions.size(); i++) {
          final RegionInfo regionInfo = generatedRegions.get(i).getRegionInfo();
          if (!(getRegionSizeMB(master, regionInfo) >= regionSizesMb[i])) {
            return false;
          }
        }
        return true;
      }
    });
    return 4;
  }
Create a table with 4 regions, having region sizes so as to provoke a split of the largest
region and a merge of an empty region into the largest.
<ul>
<li>total table size: 14</li>
<li>average region size: 3.5</li>
</ul>
hbase-server/src/test/java/org/apache/hadoop/hbase/master/normalizer/TestSimpleRegionNormalizerOnCluster.java