@Before
  public void setUp() throws Exception {
    final MongoDatabase database = context.database();
    this.collection = database.getCollection("jackson").withDocumentClass(BsonDocument.class);

    SimpleModule module = new SimpleModule(); // for our local serializers of Date and ObjectId
    module.addDeserializer(Date.class, new DateDeserializer());
    module.addSerializer(new DateSerializer());
    module.addDeserializer(ObjectId.class, new ObjectIdDeserializer());
    module.addSerializer(new ObjectIdSerializer());

    UuidCodec uuidCodec = new UuidCodec(UuidRepresentation.JAVA_LEGACY);
    module.addDeserializer(UUID.class, new UUIDDeserializer(uuidCodec));
    module.addSerializer(UUID.class, new UUIDSerializer(uuidCodec));

    ObjectMapper mapper = new ObjectMapper()
        // to support bson types like: Document, BsonValue etc.
        .registerModule(JacksonCodecs.module(MongoClientSettings.getDefaultCodecRegistry()))
        .registerModule(new GuavaModule())
        .registerModule(module);

    RepositorySetup setup = RepositorySetup.builder()
            .database(database)
            .codecRegistry(JacksonCodecs.registryFromMapper(mapper))
            .executor(MoreExecutors.newDirectExecutorService())
            .build();

    this.repository = new JacksonRepository(setup);
  }
Tests for repository using <a href="https://github.com/FasterXML/jackson">Jackson</a> library.
@see JacksonCodecs
mongo/test/org/immutables/mongo/fixture/JacksonRepoTest.java