public static void assertVersions(final Table incommon, final long[] tss) throws IOException {
    // Assert that 'latest' is what we expect.
    Get get = null;
    get = new Get(ROW);
    get.addColumn(FAMILY_NAME, QUALIFIER_NAME);
    Result r = incommon.get(get);
    byte[] bytes = r.getValue(FAMILY_NAME, QUALIFIER_NAME);
    long t = Bytes.toLong(bytes);
    Assert.assertEquals(tss[0], t);

    // Now assert that if we ask for multiple versions, that they come out in
    // order.
    get = new Get(ROW);
    get.addColumn(FAMILY_NAME, QUALIFIER_NAME);
    get.readVersions(tss.length);
    Result result = incommon.get(get);
    Cell[] kvs = result.rawCells();
    Assert.assertEquals(kvs.length, tss.length);
    for (int i = 0; i < kvs.length; i++) {
      t = Bytes.toLong(CellUtil.cloneValue(kvs[i]));
      Assert.assertEquals(tss[i], t);
    }

    // Determine highest stamp to set as next max stamp
    long maxStamp = kvs[0].getTimestamp();

    // Specify a timestamp get multiple versions.
    get = new Get(ROW);
    get.addColumn(FAMILY_NAME, QUALIFIER_NAME);
    get.setTimeRange(0, maxStamp);
    get.readVersions(kvs.length - 1);
    result = incommon.get(get);
    kvs = result.rawCells();
    Assert.assertEquals(kvs.length, tss.length - 1);
    for (int i = 1; i < kvs.length; i++) {
      t = Bytes.toLong(CellUtil.cloneValue(kvs[i - 1]));
      Assert.assertEquals(tss[i], t);
    }

    // Test scanner returns expected version
    assertScanContentTimestamp(incommon, tss[0]);
  }
Tests user specifiable time stamps putting, getting and scanning. Also tests same in presence of
deletes. Test cores are written so can be run against an HRegion and against an HTable: i.e. both
local and remote.
hbase-server/src/test/java/org/apache/hadoop/hbase/TimestampTestBase.java