@Test
  public void testKeepDeletedCells() throws Exception {
    final TableName tableName = name.getTableName();
    final byte[] FAMILY = Bytes.toBytes("family");
    final byte[] C0 = Bytes.toBytes("c0");

    final byte[] T1 = Bytes.toBytes("T1");
    final byte[] T2 = Bytes.toBytes("T2");
    final byte[] T3 = Bytes.toBytes("T3");

    TableDescriptor tableDescriptor = TableDescriptorBuilder.newBuilder(tableName)
      .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(FAMILY)
        .setKeepDeletedCells(KeepDeletedCells.TRUE).setMaxVersions(3).build())
      .build();
    TEST_UTIL.getAdmin().createTable(tableDescriptor);
    try (Table h = TEST_UTIL.getConnection().getTable(tableName)) {
      long ts = EnvironmentEdgeManager.currentTime();
      Put p = new Put(T1, ts);
      p.addColumn(FAMILY, C0, T1);
      h.put(p);
      p = new Put(T1, ts + 2);
      p.addColumn(FAMILY, C0, T2);
      h.put(p);
      p = new Put(T1, ts + 4);
      p.addColumn(FAMILY, C0, T3);
      h.put(p);

      Delete d = new Delete(T1, ts + 3);
      h.delete(d);

      d = new Delete(T1, ts + 3);
      d.addColumns(FAMILY, C0, ts + 3);
      h.delete(d);

      Get g = new Get(T1);
      // does *not* include the delete
      g.setTimeRange(0, ts + 3);
      Result r = h.get(g);
      assertArrayEquals(T2, r.getValue(FAMILY, C0));

      Scan s = new Scan().withStartRow(T1);
      s.setTimeRange(0, ts + 3);
      s.readAllVersions();
      ResultScanner scanner = h.getScanner(s);
      ExtendedCell[] kvs = scanner.next().rawExtendedCells();
      assertArrayEquals(T2, CellUtil.cloneValue(kvs[0]));
      assertArrayEquals(T1, CellUtil.cloneValue(kvs[1]));
      scanner.close();

      s = new Scan().withStartRow(T1);
      s.setRaw(true);
      s.readAllVersions();
      scanner = h.getScanner(s);
      kvs = scanner.next().rawExtendedCells();
      assertTrue(PrivateCellUtil.isDeleteFamily(kvs[0]));
      assertArrayEquals(T3, CellUtil.cloneValue(kvs[1]));
      assertTrue(CellUtil.isDelete(kvs[2]));
      assertArrayEquals(T2, CellUtil.cloneValue(kvs[3]));
      assertArrayEquals(T1, CellUtil.cloneValue(kvs[4]));
      scanner.close();
    }
  }
Basic client side validation of HBASE-4536
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java