@Test
  public void testPosition() throws Exception {
    long lastPosition = 0;
    appendEntriesToLogAndSync(3);
    // read only one element
    try (WALEntryStream entryStream = new WALEntryStream(logQueue, fs, CONF, lastPosition, log,
      new MetricsSource("1"), fakeWalGroupId)) {
      assertNotNull(next(entryStream));
      lastPosition = entryStream.getPosition();
    }
    // there should still be two more entries from where we left off
    try (WALEntryStream entryStream = new WALEntryStream(logQueue, fs, CONF, lastPosition, log,
      new MetricsSource("1"), fakeWalGroupId)) {
      assertNotNull(next(entryStream));
      assertNotNull(next(entryStream));
      assertEquals(HasNext.RETRY, entryStream.hasNext());
    }
  }
Tests that if we stop before hitting the end of a stream, we can continue where we left off
using the last position
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestBasicWALEntryStream.java