CountUpdateBloomFilterWrapper implements BloomFilter { @Override public void writeTo(OutputStream out) throws IOException { filter.writeTo(out); } CountUpdateBloomFilterWrapper(BloomFilter filter, LongAdder filterUpdateTimesCounter); @Override int expectedInsertions(); @Override double fpp(); @Override boolean mightContain(String value); @Override boolean set(String value); @Override boolean valid(); @Override void writeTo(OutputStream out); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testWriteToThrowException() throws IOException { final OutputStream out = new ByteArrayOutputStream(); final IOException expectedException = new IOException("expected IO exception"); doThrow(expectedException).when(innerFilter).writeTo(out); assertThatThrownBy(() -> wrapper.writeTo(out)).isSameAs(expectedException); verify(innerFilter, times(1)).writeTo(out); }