@Test
  public void testStoreMemStore() throws Exception {
    // keep 3 versions minimum

    ColumnFamilyDescriptor cfd = ColumnFamilyDescriptorBuilder.newBuilder(c0).setMinVersions(3)
      .setMaxVersions(1000).setTimeToLive(1).setKeepDeletedCells(KeepDeletedCells.FALSE).build();

    TableDescriptor htd = TableDescriptorBuilder.newBuilder(TableName.valueOf(name.getMethodName()))
      .setColumnFamily(cfd).build();

    HRegion region = hbu.createLocalHRegion(htd, null, null);
    // 2s in the past
    long ts = EnvironmentEdgeManager.currentTime() - 2000;

    try {
      Put p = new Put(T1, ts - 1);
      p.addColumn(c0, c0, T2);
      region.put(p);

      p = new Put(T1, ts - 3);
      p.addColumn(c0, c0, T0);
      region.put(p);

      // now flush/compact
      region.flush(true);
      region.compact(true);

      p = new Put(T1, ts);
      p.addColumn(c0, c0, T3);
      region.put(p);

      p = new Put(T1, ts - 2);
      p.addColumn(c0, c0, T1);
      region.put(p);

      p = new Put(T1, ts - 3);
      p.addColumn(c0, c0, T0);
      region.put(p);

      // newest version in the memstore
      // the 2nd oldest in the store file
      // and the 3rd, 4th oldest also in the memstore

      Get g = new Get(T1);
      g.readAllVersions();
      Result r = region.get(g); // this'll use ScanWildcardColumnTracker
      checkResult(r, c0, T3, T2, T1);

      g = new Get(T1);
      g.readAllVersions();
      g.addColumn(c0, c0);
      r = region.get(g); // this'll use ExplicitColumnTracker
      checkResult(r, c0, T3, T2, T1);
    } finally {
      HBaseTestingUtil.closeRegionAndWAL(region);
    }
  }
Test mixed memstore and storefile scanning with minimum versions.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java