ExpirableBloomFilterConfig extends AbstractBloomFilterConfig<ExpirableBloomFilterConfig> { @Override public int hashCode() { int ret = super.hashCode(); ret = 31 * ret + validPeriodAfterCreate.hashCode(); if (validPeriodAfterAccess != null) { ret = 31 * ret + validPeriodAfterAccess.hashCode(); } return ret; } ExpirableBloomFilterConfig();   ExpirableBloomFilterConfig(int expectedInsertions, double fpp);   ExpirableBloomFilterConfig(ExpirableBloomFilterConfig config); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testHashCode() { 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.hashCode()).isEqualTo(filterB.hashCode()); }