@Test
  public void testRandomReadCalculation() {
    TestOptions opts = new PerformanceEvaluation.TestOptions();
    opts = PerformanceEvaluation.calculateRowsAndSize(opts);
    long rows = opts.getPerClientRunRows();
    // Default row count
    final int defaultPerClientRunRows = 1024 * 1024;
    assertEquals(defaultPerClientRunRows, rows);
    // If size is 2G, then twice the row count.
    opts.setSize(2.0f);
    opts.setPerClientRunRows(1000);
    opts.setCmdName(PerformanceEvaluation.RANDOM_READ);
    opts = PerformanceEvaluation.calculateRowsAndSize(opts);
    assertEquals(1000, opts.getPerClientRunRows());
    // If two clients, then they get half the rows each.
    opts.setNumClientThreads(2);
    opts = PerformanceEvaluation.calculateRowsAndSize(opts);
    assertEquals(1000, opts.getPerClientRunRows());
    // assuming we will get one before this loop expires
    boolean foundValue = false;
    for (int i = 0; i < 10000000; i++) {
      long randomRow = PerformanceEvaluation.generateRandomRow(opts.totalRows);
      if (randomRow > 1000) {
        foundValue = true;
        break;
      }
    }
    assertTrue("We need to get a value more than 1000", foundValue);
  }
Exercise the mr spec writing. Simple assertions to make sure it is basically working.
hbase-diagnostics/src/test/java/org/apache/hadoop/hbase/TestPerformanceEvaluation.java