Skip to content

Commit

Permalink
Update Mongo tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim203 committed Jun 30, 2024
1 parent f172e7b commit f3e4baa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
15 changes: 4 additions & 11 deletions ap/src/test/resources/test/advanced/MongoDatabaseGenerated.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.mongodb.client.model.IndexOptions;
import java.lang.Class;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -52,15 +51,9 @@ static void createEntities(MongodbDatabase database) throws MongoException {
}

private static final class TestEntityCodec implements Codec<TestEntity> {
private final Codec<String> b;

private final Codec<String> c;

private final Codec<UUID> d;

public TestEntityCodec(CodecRegistry registry) {
this.b = registry.get(String.class);
this.c = registry.get(String.class);
this.d = registry.get(UUID.class);
}

Expand All @@ -75,11 +68,11 @@ public TestEntity decode(BsonReader reader, DecoderContext context) {
continue;
}
if ("b".equals(name)) {
map.put("b", this.b.decode(reader, context));
map.put("b", reader.readString());
continue;
}
if ("c".equals(name)) {
map.put("c", this.c.decode(reader, context));
map.put("c", reader.readString());
continue;
}
if ("d".equals(name)) {
Expand All @@ -101,9 +94,9 @@ public void encode(BsonWriter writer, TestEntity value, EncoderContext context)
writer.writeName("a");
writer.writeInt32(value.a());
writer.writeName("b");
this.b.encode(writer, value.b(), context);
writer.writeString(value.b());
writer.writeName("c");
this.c.encode(writer, value.c(), context);
writer.writeString(value.c());
writer.writeName("d");
this.d.encode(writer, value.d(), context);
writer.writeEndDocument();
Expand Down
15 changes: 4 additions & 11 deletions ap/src/test/resources/test/basic/MongoDatabaseGenerated.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.mongodb.client.model.IndexOptions;
import java.lang.Class;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -52,15 +51,9 @@ static void createEntities(MongodbDatabase database) throws MongoException {
}

private static final class TestEntityCodec implements Codec<TestEntity> {
private final Codec<String> b;

private final Codec<String> c;

private final Codec<UUID> d;

public TestEntityCodec(CodecRegistry registry) {
this.b = registry.get(String.class);
this.c = registry.get(String.class);
this.d = registry.get(UUID.class);
}

Expand All @@ -75,11 +68,11 @@ public TestEntity decode(BsonReader reader, DecoderContext context) {
continue;
}
if ("b".equals(name)) {
map.put("b", this.b.decode(reader, context));
map.put("b", reader.readString());
continue;
}
if ("c".equals(name)) {
map.put("c", this.c.decode(reader, context));
map.put("c", reader.readString());
continue;
}
if ("d".equals(name)) {
Expand All @@ -101,9 +94,9 @@ public void encode(BsonWriter writer, TestEntity value, EncoderContext context)
writer.writeName("a");
writer.writeInt32(value.a());
writer.writeName("b");
this.b.encode(writer, value.b(), context);
writer.writeString(value.b());
writer.writeName("c");
this.c.encode(writer, value.c(), context);
writer.writeString(value.c());
writer.writeName("d");
this.d.encode(writer, value.d(), context);
writer.writeEndDocument();
Expand Down

0 comments on commit f3e4baa

Please sign in to comment.