private void testRegionReplicaReplication(int regionReplication, boolean skipWAL)
    throws Exception {
    // test region replica replication. Create a table with single region, write some data
    // ensure that data is replicated to the secondary region
    TableName tableName = TableName.valueOf("testRegionReplicaReplicationWithReplicas_"
      + regionReplication + (skipWAL ? "_skipWAL" : ""));
    TableDescriptorBuilder builder =
      HTU
        .createModifyableTableDescriptor(TableName.valueOf(tableName.toString()),
          ColumnFamilyDescriptorBuilder.DEFAULT_MIN_VERSIONS, 3, HConstants.FOREVER,
          ColumnFamilyDescriptorBuilder.DEFAULT_KEEP_DELETED)
        .setRegionReplication(regionReplication);
    if (skipWAL) {
      builder.setDurability(Durability.SKIP_WAL);
    }
    TableDescriptor htd = builder.build();
    createOrEnableTableWithRetries(htd, true);
    TableName tableNameNoReplicas =
      TableName.valueOf("testRegionReplicaReplicationWithReplicas_NO_REPLICAS");
    HTU.deleteTableIfAny(tableNameNoReplicas);
    HTU.createTable(tableNameNoReplicas, HBaseTestingUtil.fam1);

    try (Connection connection = ConnectionFactory.createConnection(HTU.getConfiguration());
      Table table = connection.getTable(tableName);
      Table tableNoReplicas = connection.getTable(tableNameNoReplicas)) {
      // load some data to the non-replicated table
      HTU.loadNumericRows(tableNoReplicas, HBaseTestingUtil.fam1, 6000, 7000);

      // load the data to the table
      HTU.loadNumericRows(table, HBaseTestingUtil.fam1, 0, 1000);

      verifyReplication(tableName, regionReplication, 0, 1000);
    } finally {
      HTU.deleteTableIfAny(tableNameNoReplicas);
    }
  }
Tests region replication by setting up region replicas and verifying async wal replication
replays the edits to the secondary region in various scenarios.
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplication.java