@Test
  public void testUsingMetaAndBinary() throws IOException {
    Path rootdir = UTIL.getDataTestDirOnTestFS();
    // Up flush size else we bind up when we use default catalog flush of 16k.
    TableDescriptors tds = new FSTableDescriptors(UTIL.getConfiguration());
    FSTableDescriptors.tryUpdateMetaTableDescriptor(UTIL.getConfiguration());
    TableDescriptor td = tds.get(TableName.META_TABLE_NAME);
    td = TableDescriptorBuilder.newBuilder(td).setMemStoreFlushSize(64 * 1024 * 1024).build();
    HRegion mr = HBaseTestingUtil.createRegionAndWAL(RegionInfoBuilder.FIRST_META_REGIONINFO,
      rootdir, conf, td);
    try {
      // Write rows for three tables 'A', 'B', and 'C'.
      for (char c = 'A'; c < 'D'; c++) {
        TableDescriptor htd = TableDescriptorBuilder.newBuilder(TableName.valueOf("" + c)).build();
        final int last = 128;
        final int interval = 2;
        for (int i = 0; i <= last; i += interval) {
          RegionInfo hri = RegionInfoBuilder.newBuilder(htd.getTableName())
            .setStartKey(i == 0 ? HConstants.EMPTY_BYTE_ARRAY : Bytes.toBytes((byte) i))
            .setEndKey(i == last ? HConstants.EMPTY_BYTE_ARRAY : Bytes.toBytes((byte) i + interval))
            .build();
          Put put =
            MetaTableAccessor.makePutFromRegionInfo(hri, EnvironmentEdgeManager.currentTime());
          put.setDurability(Durability.SKIP_WAL);
          LOG.info("Put {}", put);
          mr.put(put);
        }
      }
      InternalScanner s = mr.getScanner(new Scan());
      try {
        List<Cell> keys = new ArrayList<>();
        while (s.next(keys)) {
          LOG.info("Scan {}", keys);
          keys.clear();
        }
      } finally {
        s.close();
      }
      findRow(mr, 'C', 44, 44);
      findRow(mr, 'C', 45, 44);
      findRow(mr, 'C', 46, 46);
      findRow(mr, 'C', 43, 42);
      mr.flush(true);
      findRow(mr, 'C', 44, 44);
      findRow(mr, 'C', 45, 44);
      findRow(mr, 'C', 46, 46);
      findRow(mr, 'C', 43, 42);
      // Now delete 'C' and make sure I don't get entries from 'B'.
      byte[] firstRowInC = RegionInfo.createRegionName(TableName.valueOf("" + 'C'),
        HConstants.EMPTY_BYTE_ARRAY, HConstants.ZEROES, false);
      Scan scan = new Scan().withStartRow(firstRowInC);
      s = mr.getScanner(scan);
      try {
        List<Cell> keys = new ArrayList<>();
        while (s.next(keys)) {
          LOG.info("Delete {}", keys);
          mr.delete(new Delete(CellUtil.cloneRow(keys.get(0))));
          keys.clear();
        }
      } finally {
        s.close();
      }
      // Assert we get null back (pass -1).
      findRow(mr, 'C', 44, -1);
      findRow(mr, 'C', 45, -1);
      findRow(mr, 'C', 46, -1);
      findRow(mr, 'C', 43, -1);
      mr.flush(true);
      findRow(mr, 'C', 44, -1);
      findRow(mr, 'C', 45, -1);
      findRow(mr, 'C', 46, -1);
      findRow(mr, 'C', 43, -1);
    } finally {
      HBaseTestingUtil.closeRegionAndWAL(mr);
    }
  }
TestGet is a medley of tests of get all done up as a single test. It was originally written to
test a method since removed, getClosestAtOrBefore but the test is retained because it runs some
interesting exercises.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestGetClosestAtOrBefore.java