@Test
  public void encodeDecode() throws IOException {
    BsonModel model = DEFAULT;
    final CodecRegistry registry = JacksonCodecs.registryFromMapper(mapper);

    // read
    BsonModel model2 = writeThenRead(registry, mapper, model);

    check(model2.localDate()).is(model.localDate());
    check(model2.utilDate()).is(model.utilDate());
    check(model2.objectId()).is(model.objectId());
    check(model2.map().keySet()).isOf("key1");
    check(model2.map()).is(model.map());
    check(model2.document().keySet()).hasContentInAnyOrder("docKey");
  }
Test that regular expression is correctly encoded
criteria/mongo/test/org/immutables/criteria/mongo/bson4jackson/JacksonCodecsTest.java