@Test
  public void basic() {
    LocalCodec codecAndStrategy = new LocalCodec();

    CodecRegistry registry = CodecRegistries.fromRegistries(codecAndStrategy,
            MongoClientSettings.getDefaultCodecRegistry());


    RepositorySetup.FieldNamingStrategy strategy = new RepositorySetup.FieldNamingStrategy() {
      @Override
      public String translateName(Member member) {
        return "date".equals(member.getName()) ? "dateChanged" : member.getName();
      }
    };

    RepositorySetup setup = RepositorySetup.builder()
            .executor(MoreExecutors.newDirectExecutorService())
            .database(context.database())
            .codecRegistry(registry, strategy)
            .build();

    SomebodyRepository repository = new SomebodyRepository(setup);

    ImmutableSomebody somebody = ImmutableSomebody.builder().id(new ObjectId()).date(new Date()).prop1("prop1").build();
    repository.insert(somebody)
            .getUnchecked();

    check(repository.findById(somebody.id()).fetchAll().getUnchecked()).hasAll(somebody);
    check(repository.find(repository.criteria().prop1(somebody.prop1())).fetchAll().getUnchecked()).hasAll(somebody);
    check(repository.find(repository.criteria().prop1("unknown")).fetchAll().getUnchecked()).isEmpty();
    check(repository.find(repository.criteria().date(somebody.date())).fetchAll().getUnchecked()).hasAll(somebody);
    check(repository.find(repository.criteria().date(new Date(somebody.date().getTime() + 1)))
            .fetchAll().getUnchecked()).isEmpty();
  }
Tests repositories which are using directly with Bson codecs (not {@code Gson} adapter).
mongo/test/org/immutables/mongo/fixture/BsonCodecRepoTest.java