### Question:
FileBasedBloomFilter { @Nonnull public static <T> BloomFilter<T> create( @Nonnull final Path filename, @Nonnull final Funnel<? super T> funnel, long expectedInsertions, double falsePositivesProbability ) { Preconditions.checkNotNull(filename, "filename"); Preconditions.checkNotNull(funnel, "funnel"); Preconditions.checkArgument( expectedInsertions > 0, "expectedInsertions=%s must be bigger than zero", expectedInsertions ); Preconditions.checkArgument( falsePositivesProbability > 0, "falsePositivesProbability=%s must be bigger than zero", falsePositivesProbability ); Preconditions.checkArgument( falsePositivesProbability < 1.0, "falsePositivesProbability=%s must be less than 1.0", falsePositivesProbability ); final BitArray.Factory factory = BitArrayFactories.mappedFile(getDataFilePath(filename), ByteOrder.nativeOrder()); final GuavaBloomFilter<T> filter = GuavaBloomFilter.create(funnel, expectedInsertions, falsePositivesProbability, factory); try { MAPPER.writeValue(filename.toFile(), filter.getParameters()); } catch (IOException e) { throw new IllegalStateException("Failed to save metadata for " + filename, e); } return filter; }  @Nonnull static BloomFilter<T> create(
            @Nonnull final Path filename,
            @Nonnull final Funnel<? super T> funnel,
            long expectedInsertions,
            double falsePositivesProbability
    ); @Nonnull static BloomFilter<T> open(@Nonnull final Path filename, @Nonnull final Funnel<? super T> funnel); @Nonnull static Path getDataFilePath(@Nonnull final Path mainPath);  }### Answer:
@Test void shouldCreate() { final File file = temporaryFolder.resolve("test.bloom").toFile(); final BloomFilter<Integer> filter = FileBasedBloomFilter.create( file.toPath(), Funnels.integerFunnel(), 100, 0.1 ); assertThat(filter).isNotNull(); assertThat(file).exists(); }
@Test void shouldNotFindAnythingBeforeInserting() { final File file = temporaryFolder.resolve("test.bloom").toFile(); final BloomFilter<Integer> filter = FileBasedBloomFilter.create( file.toPath(), Funnels.integerFunnel(), 100, 0.1 ); final boolean checkOne = filter.mightContain(1); final boolean checkTwo = filter.mightContain(1); assertThat(checkOne).isFalse(); assertThat(checkTwo).isFalse(); }
@Test void shouldFindAfterInserting() { final File file = temporaryFolder.resolve("test.bloom").toFile(); final BloomFilter<Integer> filter = FileBasedBloomFilter.create( file.toPath(), Funnels.integerFunnel(), 100, 0.1 ); final boolean changed = filter.put(1); final boolean found = filter.mightContain(1); assertThat(changed).isTrue(); assertThat(found).isTrue(); }