@Test
  public void setMembershipDedups() throws IOException {
    Configuration localConf = new Configuration(conf);
    localConf.set(WALFactory.WAL_PROVIDER, FSHLogProvider.class.getName());
    WALFactory wals = new WALFactory(localConf, currentTest.getMethodName());
    try {
      final Set<WAL> seen = new HashSet<>(1);
      assertTrue("first attempt to add WAL from default provider should work.",
        seen.add(wals.getWAL(null)));
      for (int i = 0; i < 1000; i++) {
        assertFalse(
          "default wal provider is only supposed to return a single wal, which should "
            + "compare as .equals itself.",
          seen.add(wals.getWAL(RegionInfoBuilder
            .newBuilder(TableName.valueOf("Table-" + ThreadLocalRandom.current().nextInt()))
            .build())));
      }
    } finally {
      wals.close();
    }
  }
Ensure that we can use Set.add to deduplicate WALs
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestFSHLogProvider.java