public static void doRead(ProtobufWALStreamReader reader, boolean withTrailer, RegionInfo hri,
    TableName tableName, int columnCount, int recordCount, byte[] row, long timestamp)
    throws IOException {
    if (withTrailer) {
      assertNotNull(reader.trailer);
    } else {
      assertNull(reader.trailer);
    }
    for (int i = 0; i < recordCount; ++i) {
      WAL.Entry entry = reader.next();
      assertNotNull(entry);
      assertEquals(columnCount, entry.getEdit().size());
      assertArrayEquals(hri.getEncodedNameAsBytes(), entry.getKey().getEncodedRegionName());
      assertEquals(tableName, entry.getKey().getTableName());
      int idx = 0;
      for (Cell val : entry.getEdit().getCells()) {
        assertTrue(Bytes.equals(row, 0, row.length, val.getRowArray(), val.getRowOffset(),
          val.getRowLength()));
        assertArrayEquals(toValue(i, idx), CellUtil.cloneValue(val));
        idx++;
      }
    }
    if (withTrailer) {
      // we can finish normally
      assertNull(reader.next());
    } else {
      // we will get an EOF since there is no trailer
      assertThrows(EOFException.class, () -> reader.next());
    }
  }
Helper class for testing protobuf log.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogTestHelper.java