public static void doTestWithMapReduce(HBaseTestingUtil util, TableName tableName,
    String snapshotName, byte[] startRow, byte[] endRow, Path tableDir, int numRegions,
    int numSplitsPerRegion, int expectedNumSplits, boolean shutdownCluster) throws Exception {

    LOG.info("testing with MapReduce");

    LOG.info("create the table and snapshot");
    createTableAndSnapshot(util, tableName, snapshotName, startRow, endRow, numRegions);

    if (shutdownCluster) {
      LOG.info("shutting down hbase cluster.");
      util.shutdownMiniHBaseCluster();
    }

    try {
      // create the job
      Job job = new Job(util.getConfiguration());
      Scan scan = new Scan().withStartRow(startRow).withStopRow(endRow); // limit the scan

      job.setJarByClass(util.getClass());
      TableMapReduceUtil.addDependencyJarsForClasses(job.getConfiguration(),
        TestTableSnapshotInputFormat.class);

      if (numSplitsPerRegion > 1) {
        TableMapReduceUtil.initTableSnapshotMapperJob(snapshotName, scan,
          TestTableSnapshotMapper.class, ImmutableBytesWritable.class, NullWritable.class, job,
          true, tableDir, new RegionSplitter.UniformSplit(), numSplitsPerRegion);
      } else {
        TableMapReduceUtil.initTableSnapshotMapperJob(snapshotName, scan,
          TestTableSnapshotMapper.class, ImmutableBytesWritable.class, NullWritable.class, job,
          true, tableDir);
      }

      job.setReducerClass(TestTableSnapshotInputFormat.TestTableSnapshotReducer.class);
      job.setNumReduceTasks(1);
      job.setOutputFormatClass(NullOutputFormat.class);

      Assert.assertTrue(job.waitForCompletion(true));
    } finally {
      if (!shutdownCluster) {
        util.getAdmin().deleteSnapshot(snapshotName);
        util.deleteTable(tableName);
      }
    }
  }
Serializes and deserializes the given scan in the same manner that TableSnapshotInputFormat
does.
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSnapshotInputFormat.java