@Test
  public void testGetRowVersions() throws Exception {
    final byte[] contents = Bytes.toBytes("contents");
    final byte[] row = Bytes.toBytes("row");
    final byte[] value1 = Bytes.toBytes("value1");
    final byte[] value2 = Bytes.toBytes("value2");
    final long timestamp1 = 100L;
    final long timestamp2 = 200L;
    TableDescriptor tableDescriptor = TableDescriptorBuilder
      .newBuilder(TableName.valueOf(name.getMethodName()))
      .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(contents).setMaxVersions(3).build())
      .build();
    this.admin.createTable(tableDescriptor);
    Put put = new Put(row, timestamp1);
    put.addColumn(contents, contents, value1);
    Table table = UTIL.getConnection().getTable(tableDescriptor.getTableName());
    table.put(put);
    // Shut down and restart the HBase cluster
    table.close();
    UTIL.shutdownMiniHBaseCluster();
    LOG.debug("HBase cluster shut down -- restarting");
    StartTestingClusterOption option =
      StartTestingClusterOption.builder().numRegionServers(NUM_SLAVES).build();
    UTIL.startMiniHBaseCluster(option);
    // Make a new connection.
    table = UTIL.getConnection().getTable(tableDescriptor.getTableName());
    // Overwrite previous value
    put = new Put(row, timestamp2);
    put.addColumn(contents, contents, value2);
    table.put(put);
    // Now verify that getRow(row, column, latest) works
    Get get = new Get(row);
    // Should get one version by default
    Result r = table.get(get);
    assertNotNull(r);
    assertFalse(r.isEmpty());
    assertEquals(1, r.size());
    byte[] value = r.getValue(contents, contents);
    assertNotEquals(0, value.length);
    assertTrue(Bytes.equals(value, value2));
    // Now check getRow with multiple versions
    get = new Get(row);
    get.readAllVersions();
    r = table.get(get);
    assertEquals(2, r.size());
    value = r.getValue(contents, contents);
    assertNotEquals(0, value.length);
    assertArrayEquals(value, value2);
    NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> map = r.getMap();
    NavigableMap<byte[], NavigableMap<Long, byte[]>> familyMap = map.get(contents);
    NavigableMap<Long, byte[]> versionMap = familyMap.get(contents);
    assertEquals(2, versionMap.size());
    assertArrayEquals(value1, versionMap.get(timestamp1));
    assertArrayEquals(value2, versionMap.get(timestamp2));
    table.close();
  }
Verifies versions across a cluster restart.
<p/>
Port of old TestGetRowVersions test to here so can better utilize the spun up cluster running
more than a single test per spin up. Keep old tests' crazyness.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestMultiVersions.java