protected void assertScannerResults(KeyValueScanner scanner, KeyValue[] expected)
    throws IOException {
    scanner.seek(KeyValueUtil.createFirstOnRow(new byte[] {}));
    List<Cell> returned = Lists.newArrayList();

    while (true) {
      Cell next = scanner.next();
      if (next == null) break;
      returned.add(next);
    }

    assertTrue(
      "Got:\n" + Joiner.on("\n").join(returned) + "\nExpected:\n" + Joiner.on("\n").join(expected),
      Iterables.elementsEqual(Arrays.asList(expected), returned));
    assertNull(scanner.peek());
  }
A simple test which verifies the 3 possible states when scanning across snapshot.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java