private void verifyWithMockedMapReduce(Job job, int numRegions, int expectedNumSplits,
    byte[] startRow, byte[] stopRow) throws IOException, InterruptedException {
    TableSnapshotInputFormat tsif = new TableSnapshotInputFormat();
    List<InputSplit> splits = tsif.getSplits(job);

    Assert.assertEquals(expectedNumSplits, splits.size());

    HBaseTestingUtil.SeenRowTracker rowTracker = new HBaseTestingUtil.SeenRowTracker(startRow,
      stopRow.length > 0 ? stopRow : Bytes.toBytes("\uffff"));

    boolean localityEnabled = job.getConfiguration().getBoolean(
      SNAPSHOT_INPUTFORMAT_LOCALITY_ENABLED_KEY, SNAPSHOT_INPUTFORMAT_LOCALITY_ENABLED_DEFAULT);

    boolean byRegionLoc =
      job.getConfiguration().getBoolean(SNAPSHOT_INPUTFORMAT_LOCALITY_BY_REGION_LOCATION,
        SNAPSHOT_INPUTFORMAT_LOCALITY_BY_REGION_LOCATION_DEFAULT);
    for (int i = 0; i < splits.size(); i++) {
      // validate input split
      InputSplit split = splits.get(i);
      Assert.assertTrue(split instanceof TableSnapshotRegionSplit);
      TableSnapshotRegionSplit snapshotRegionSplit = (TableSnapshotRegionSplit) split;
      if (localityEnabled) {
        Assert.assertTrue(split.getLocations() != null && split.getLocations().length != 0);
        if (byRegionLoc) {
          // When it uses region location from meta, the hostname will be "localhost",
          // the location from hdfs block location is "127.0.0.1".
          Assert.assertEquals(1, split.getLocations().length);
          Assert.assertTrue("Not using region location!",
            split.getLocations()[0].equals("localhost"));
        } else {
          Assert.assertTrue("Not using region location!",
            split.getLocations()[0].equals("127.0.0.1"));
        }
      } else {
        Assert.assertTrue(split.getLocations() != null && split.getLocations().length == 0);
      }

      Scan scan =
        TableMapReduceUtil.convertStringToScan(snapshotRegionSplit.getDelegate().getScan());
      if (startRow.length > 0) {
        Assert.assertTrue(
          Bytes.toStringBinary(startRow) + " should <= " + Bytes.toStringBinary(scan.getStartRow()),
          Bytes.compareTo(startRow, scan.getStartRow()) <= 0);
      }
      if (stopRow.length > 0) {
        Assert.assertTrue(
          Bytes.toStringBinary(stopRow) + " should >= " + Bytes.toStringBinary(scan.getStopRow()),
          Bytes.compareTo(stopRow, scan.getStopRow()) >= 0);
      }
      Assert.assertTrue("startRow should < stopRow",
        Bytes.compareTo(scan.getStartRow(), scan.getStopRow()) < 0);

      // validate record reader
      TaskAttemptContext taskAttemptContext = mock(TaskAttemptContext.class);
      when(taskAttemptContext.getConfiguration()).thenReturn(job.getConfiguration());
      RecordReader<ImmutableBytesWritable, Result> rr =
        tsif.createRecordReader(split, taskAttemptContext);
      rr.initialize(split, taskAttemptContext);

      // validate we can read all the data back
      while (rr.nextKeyValue()) {
        byte[] row = rr.getCurrentKey().get();
        verifyRowFromMap(rr.getCurrentKey(), rr.getCurrentValue());
        rowTracker.addRow(row);
      }

      rr.close();
    }

    // validate all rows are seen
    rowTracker.validate();
  }
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