ExpirableBloomFilterConfig extends AbstractBloomFilterConfig<ExpirableBloomFilterConfig> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; final ExpirableBloomFilterConfig that = (ExpirableBloomFilterConfig) o; return validPeriodAfterCreate.equals(that.validPeriodAfterCreate) && (validPeriodAfterAccess == null || validPeriodAfterAccess.equals(that.validPeriodAfterAccess)); } ExpirableBloomFilterConfig();   ExpirableBloomFilterConfig(int expectedInsertions, double fpp);   ExpirableBloomFilterConfig(ExpirableBloomFilterConfig config); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { final int validPeriod = ThreadLocalRandom.current().nextInt(0, Integer.MAX_VALUE); final double fpp = ThreadLocalRandom.current().nextDouble(0.0001, 1); final int expectedInsertions = ThreadLocalRandom.current().nextInt(1, Integer.MAX_VALUE); final ExpirableBloomFilterConfig filterA = new ExpirableBloomFilterConfig() .setValidPeriodAfterCreate(Duration.ofSeconds(validPeriod)) .setFpp(fpp) .setExpectedInsertions(expectedInsertions); final ExpirableBloomFilterConfig filterB = new ExpirableBloomFilterConfig() .setValidPeriodAfterCreate(Duration.ofSeconds(validPeriod)) .setFpp(fpp) .setExpectedInsertions(expectedInsertions); assertThat(filterA).isEqualTo(filterB); }