AbstractBloomFilterConfig implements BloomFilterConfig<T>, Cloneable { @SuppressWarnings("unchecked") @Override public T setExpectedInsertions(int expectedInsertions) { checkParameter("expectedInsertions", expectedInsertions > 0, "expected: > 0, actual: %s", expectedInsertions); this.expectedInsertions = expectedInsertions; return self(); } AbstractBloomFilterConfig();   AbstractBloomFilterConfig(int expectedInsertions, double fpp); int expectedInsertions(); double fpp(); @SuppressWarnings("unchecked") @Override T setExpectedInsertions(int expectedInsertions); @SuppressWarnings("unchecked") @Override T setFpp(double fpp); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testGetAndSetInvalidExpectedInsertions() { final int invalidExpectedInsertions = -1 * Math.abs(ThreadLocalRandom.current().nextInt()); final TestingBloomFilterConfig config = new TestingBloomFilterConfig(); assertThatThrownBy(() -> config.setExpectedInsertions(invalidExpectedInsertions)) .isInstanceOf(BadParameterException.class) .hasMessageContaining("invalid parameter"); }