@Test
  public void testCleanClosedWALs() throws Exception {
    try (WALEntryStream entryStream = new WALEntryStreamWithRetries(logQueue, fs, CONF, 0, log,
      logQueue.getMetrics(), fakeWalGroupId)) {
      assertEquals(0, logQueue.getMetrics().getUncleanlyClosedWALs());
      appendToLogAndSync();
      assertNotNull(next(entryStream));
      log.rollWriter();
      appendToLogAndSync();
      assertNotNull(next(entryStream));
      assertEquals(0, logQueue.getMetrics().getUncleanlyClosedWALs());
    }
  }
Tests that wals are closed cleanly and we read the trailer when we remove wal from
WALEntryStream.
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestBasicWALEntryStream.java