gnodet commented on code in PR #26103:
URL: https://github.com/apache/camel/pull/26103#discussion_r3951587911


##########
components/camel-jackson3/src/test/java/org/apache/camel/component/jackson3/JacksonFeaturesTest.java:
##########
@@ -16,36 +16,60 @@
  */
 package org.apache.camel.component.jackson3;
 
+import java.util.Date;
+
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 import tools.jackson.databind.DeserializationFeature;
 import tools.jackson.databind.MapperFeature;
 import tools.jackson.databind.SerializationFeature;
+import tools.jackson.databind.cfg.DateTimeFeature;
 
 public class JacksonFeaturesTest extends CamelTestSupport {
 
     @Test
     public void testEnableDeserializationFeature() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
         mock.message(0).body().isNull();
 
         template.send("direct:format", exchange -> 
exchange.getIn().setBody("[]"));
 
-        mock.expectedMessageCount(1);
-
         mock.assertIsSatisfied();
     }
 
     @Test
     public void testEnableMapperFeature() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
         mock.message(0).body().isInstanceOf(TestPojo.class);
 
         template.send("direct:format", exchange -> 
exchange.getIn().setBody("{\"nAmE\": \"test\"}"));
 
+        mock.assertIsSatisfied();
+    }
+
+    @Test
+    public void testEnableDatatypeFeature() throws Exception {

Review Comment:
   💡 **Nit:** `body().isEqualTo("123")` works here because Camel's 
`typeCoerceEquals` converts the `byte[]` marshal output to `String` before 
comparison. The assertion passes, but the implicit coercion is invisible to the 
reader. Consider:
   
   ```suggestion
       public void testEnableDatatypeFeature() throws Exception {
           MockEndpoint mock = getMockEndpoint("mock:result");
           mock.expectedMessageCount(1);
           mock.message(0).body(String.class).isEqualTo("123");
   ```
   
   This makes the expected type explicit and documents that the output is a 
JSON number serialised as UTF-8 bytes.



-- 
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]

Reply via email to