From beddadab04219df4fe8af8e6d81d719766295ab0 Mon Sep 17 00:00:00 2001 From: HJC96 Date: Fri, 17 Oct 2025 00:08:35 +0900 Subject: [PATCH 1/2] docs: Fix typo in README.md (regulary -> regularly) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef32f93306b..7cf774eb9fb 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Example for Maven: x.y.z ``` -Snapshot builds are also published regulary via Sonatype. +Snapshot builds are also published regularly via Sonatype. Example for Maven: From 03535c41ba96c512be0f88c2257f64eae0c505a6 Mon Sep 17 00:00:00 2001 From: HJC96 Date: Mon, 20 Oct 2025 22:42:52 +0900 Subject: [PATCH 2/2] test: Fix TODO by adding Pattern type to BSON codec test --- .../test/unit/org/bson/codecs/DocumentCodecTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bson/src/test/unit/org/bson/codecs/DocumentCodecTest.java b/bson/src/test/unit/org/bson/codecs/DocumentCodecTest.java index 7343707d5a7..f57a461a6d2 100644 --- a/bson/src/test/unit/org/bson/codecs/DocumentCodecTest.java +++ b/bson/src/test/unit/org/bson/codecs/DocumentCodecTest.java @@ -21,6 +21,7 @@ import org.bson.BsonBinaryWriter; import org.bson.BsonInt32; import org.bson.BsonObjectId; +import org.bson.BsonRegularExpression; import org.bson.ByteBufNIO; import org.bson.Document; import org.bson.BinaryVector; @@ -44,6 +45,7 @@ import java.util.Date; import java.util.HashSet; import java.util.List; +import java.util.regex.Pattern; import static java.util.Arrays.asList; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -84,14 +86,20 @@ public void testPrimitiveBSONTypeCodecs() throws IOException { doc.put("vectorFloat", BinaryVector.floatVector(new float[]{1.1f, 2.2f, 3.3f})); doc.put("vectorInt8", BinaryVector.int8Vector(new byte[]{10, 20, 30, 40})); doc.put("vectorPackedBit", BinaryVector.packedBitVector(new byte[]{(byte) 0b10101010, (byte) 0b01010101}, (byte) 3)); - // doc.put("pattern", Pattern.compile("^hello")); // TODO: Pattern doesn't override equals method! + + Pattern pattern = Pattern.compile("^hello"); + doc.put("pattern", pattern); doc.put("null", null); documentCodec.encode(writer, doc, EncoderContext.builder().build()); BsonInput bsonInput = createInputBuffer(); Document decodedDocument = documentCodec.decode(new BsonBinaryReader(bsonInput), DecoderContext.builder().build()); + + BsonRegularExpression decodedPattern = (BsonRegularExpression) decodedDocument.remove("pattern"); + doc.remove("pattern"); assertEquals(doc, decodedDocument); + assertEquals(pattern.pattern(), decodedPattern.getPattern()); } @Test