opwvhk commented on code in PR #2529:
URL: https://github.com/apache/avro/pull/2529#discussion_r1342547408
##########
lang/java/avro/src/test/java/org/apache/avro/util/internal/TestJacksonUtils.java:
##########
@@ -102,4 +114,22 @@ void testToObject() {
assertEquals("a", toObject(TextNode.valueOf("a"),
SchemaBuilder.unionOf().stringType().and().intType().endUnion()));
}
+ @ParameterizedTest
+ @MethodSource("nodes")
+ void cycle(JsonNode input) {
+ Object object = JacksonUtils.toObject(input);
+ JsonNode node = JacksonUtils.toJsonNode(object);
+ Assertions.assertEquals(input, node);
+ }
+
+ public static Stream<Arguments> nodes() {
+ ObjectNode o1 = JsonNodeFactory.instance.objectNode();
+ o1.put("intField", 123);
Review Comment:
How about small integers in a LongNode?
Note: parsing JSON text must actually create an IntNode in these cases, as
otherwise parsing a logical type `decimal` will fail!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]