CountUpdateBloomFilterFactory implements BloomFilterFactory<CountUpdateBloomFilterWrapper, C> { @Override public CountUpdateBloomFilterWrapper readFrom(InputStream stream) throws IOException { return new CountUpdateBloomFilterWrapper(factory.readFrom(stream), filterUpdateTimesCounter); } CountUpdateBloomFilterFactory(BloomFilterFactory<?, C> factory, LongAdder filterUpdateTimesCounter); @Override CountUpdateBloomFilterWrapper createFilter(C config); @Override CountUpdateBloomFilterWrapper readFrom(InputStream stream);  }
@Test public void testReadFromThrowsException() throws Exception { final InputStream in = new ByteArrayInputStream(new byte[0]); final IOException expectedEx = new IOException("expected exception"); doThrow(expectedEx).when(innerFilterFactory).readFrom(in); assertThatThrownBy(() -> wrapper.readFrom(in)).isEqualTo(expectedEx); verify(innerFilterFactory, times(1)).readFrom(in); }