GuavaBloomFilter implements ExpirableBloomFilter { @Override public String toString() { return "GuavaBloomFilter{" + ", expectedInsertions=" + expectedInsertions + ", fpp=" + fpp + ", expiration=" + expiration + ", validPeriodAfterAccess" + validPeriodAfterAccess + ", created=" + created + '}'; } @JsonCreator  GuavaBloomFilter(@JsonProperty("expectedInsertions") int expectedInsertions,
                     @JsonProperty("fpp") double fpp,
                     @JsonProperty("created") ZonedDateTime created,
                     @JsonProperty("expiration") ZonedDateTime expiration,
                     @Nullable @JsonProperty("validPeriodAfterAccess") Duration validPeriodAfterAccess);   GuavaBloomFilter(int expectedInsertions,
                     double fpp,
                     ZonedDateTime created,
                     ZonedDateTime expiration,
                     @Nullable Duration validPeriodAfterAccess,
                     Timer timer); private  GuavaBloomFilter(int expectedInsertions,
                             double fpp,
                             ZonedDateTime created,
                             ZonedDateTime expiration,
                             @Nullable Duration validPeriodAfterAccess,
                             com.google.common.hash.BloomFilter<CharSequence> filter,
                             Timer timer); @JsonSerialize(using = ZonedDateTimeSerializer.class) @JsonDeserialize(using = ZonedDateTimeDeserializer.class) ZonedDateTime created(); @Override @JsonSerialize(using = ZonedDateTimeSerializer.class) @JsonDeserialize(using = ZonedDateTimeDeserializer.class) synchronized ZonedDateTime expiration(); @Override @JsonGetter("fpp") double fpp(); @Override @JsonGetter("expectedInsertions") int expectedInsertions(); @Override boolean set(String value); @Override boolean expired(); @Override boolean mightContain(String value); void writeTo(OutputStream out); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testToJson() throws Exception { final Duration validPeriodAfterAccess = Duration.ofSeconds(10); final ExpirableBloomFilterConfig config = new ExpirableBloomFilterConfig(defaultTestingConfig); config.setValidPeriodAfterAccess(validPeriodAfterAccess); final GuavaBloomFilter expectedFilter = testingFactory.createFilter(config); final ObjectMapper mapper = new ObjectMapper(); final String json = mapper.valueToTree(expectedFilter).toString(); final GuavaBloomFilter filter = new ObjectMapper().readerFor(GuavaBloomFilter.class).readValue(json); assertThat(filter).isEqualTo(expectedFilter); }