@Test
  public void testRethrowRetriesExhaustedException() throws Exception {
    TableName notExistTable = TableName.valueOf("notExistTable");
    List<WALEntry> entries = new ArrayList<>();
    List<ExtendedCell> cells = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
      entries.add(createEntry(notExistTable, i, KeyValue.Type.Put, cells));
    }
    try {
      SINK.replicateEntries(entries, PrivateCellUtil.createExtendedCellScanner(cells.iterator()),
        replicationClusterId, baseNamespaceDir, hfileArchiveDir);
      Assert.fail("Should re-throw TableNotFoundException.");
    } catch (TableNotFoundException e) {
    }
    entries.clear();
    cells.clear();
    for (int i = 0; i < 10; i++) {
      entries.add(createEntry(TABLE_NAME1, i, KeyValue.Type.Put, cells));
    }
    try (Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration())) {
      try (Admin admin = conn.getAdmin()) {
        admin.disableTable(TABLE_NAME1);
        try {
          SINK.replicateEntries(entries,
            PrivateCellUtil.createExtendedCellScanner(cells.iterator()), replicationClusterId,
            baseNamespaceDir, hfileArchiveDir);
          Assert.fail("Should re-throw RetriesExhaustedWithDetailsException.");
        } catch (RetriesExhaustedException e) {
        } finally {
          admin.enableTable(TABLE_NAME1);
        }
      }
    }
  }
Puts are buffered, but this tests when a delete (not-buffered) is applied before the actual Put
that creates it.
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java