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


##########
components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamRouteBuilderTest.java:
##########
@@ -16,20 +16,30 @@
  */
 package org.apache.camel.component.stream;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 
-public class StreamRouteBuilderTest extends CamelTestSupport {
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+class StreamRouteBuilderTest extends CamelTestSupport {
 
     @Test
-    public void testStringContent() {
-        template.sendBody("direct:start", "this is text\n");
+    void testStringContent() {
+        Exchange result = template.send("direct:start", exchange -> 
exchange.getIn().setBody("this is text\n"));
+        assertNotNull(result);
+        assertFalse(result.isFailed(), "Sending string content should not 
cause an exchange failure");
+        assertNotNull(result.getIn().getBody(), "Exchange body should be 
preserved after sending");
     }
 
     @Test
-    public void testBinaryContent() {
-        template.sendBody("direct:start", "This is bytes\n".getBytes());
+    void testBinaryContent() {
+        Exchange result = template.send("direct:start", exchange -> 
exchange.getIn().setBody("This is bytes\n".getBytes()));
+        assertNotNull(result);
+        assertFalse(result.isFailed(), "Sending binary content should not 
cause an exchange failure");
+        assertNotNull(result.getIn().getBody(), "Exchange body should be 
preserved after sending");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Addressed — now uses `assertArrayEquals(body, 
result.getIn().getBody(byte[].class))` to verify binary body content equality.



##########
components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamSystemErrTest.java:
##########
@@ -16,23 +16,33 @@
  */
 package org.apache.camel.component.stream;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
 /**
  * Unit test for System.err
  */
-public class StreamSystemErrTest extends CamelTestSupport {
+class StreamSystemErrTest extends CamelTestSupport {
 
     @Test
-    public void testStringContent() {
-        template.sendBody("direct:in", "Hello Text World\n");
+    void testStringContent() {
+        Exchange result = template.send("direct:in", exchange -> 
exchange.getIn().setBody("Hello Text World\n"));
+        assertNotNull(result);
+        assertFalse(result.isFailed(), "Sending string content to stream:err 
should not cause an exchange failure");
+        assertNotNull(result.getIn().getBody(), "Exchange body should be 
preserved after sending");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Addressed — now verifies body content equality with the sent data.



##########
components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamSystemErrTest.java:
##########
@@ -16,23 +16,33 @@
  */
 package org.apache.camel.component.stream;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
 /**
  * Unit test for System.err
  */
-public class StreamSystemErrTest extends CamelTestSupport {
+class StreamSystemErrTest extends CamelTestSupport {
 
     @Test
-    public void testStringContent() {
-        template.sendBody("direct:in", "Hello Text World\n");
+    void testStringContent() {
+        Exchange result = template.send("direct:in", exchange -> 
exchange.getIn().setBody("Hello Text World\n"));
+        assertNotNull(result);
+        assertFalse(result.isFailed(), "Sending string content to stream:err 
should not cause an exchange failure");
+        assertNotNull(result.getIn().getBody(), "Exchange body should be 
preserved after sending");
     }
 
     @Test
-    public void testBinaryContent() {
-        template.sendBody("direct:in", "Hello Bytes World\n".getBytes());
+    void testBinaryContent() {
+        Exchange result = template.send("direct:in", exchange -> 
exchange.getIn().setBody("Hello Bytes World\n".getBytes()));
+        assertNotNull(result);
+        assertFalse(result.isFailed(), "Sending binary content to stream:err 
should not cause an exchange failure");
+        assertNotNull(result.getIn().getBody(), "Exchange body should be 
preserved after sending");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Addressed — now uses `assertArrayEquals` to verify binary body content 
equality with the sent data.



##########
components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerEncodingTest.java:
##########
@@ -16,24 +16,34 @@
  */
 package org.apache.camel.component.undertow.rest;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.undertow.BaseUndertowTest;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-public class RestUndertowProducerEncodingTest extends BaseUndertowTest {
+class RestUndertowProducerEncodingTest extends BaseUndertowTest {
 
     @Test
-    public void testSelect() {
-        
template.sendBody("rest:get:bw-web-api/v1/objects/timesheets?companyId=RD&select=personId,personName",
 "Hello World");
+    void testSelect() {
+        Exchange result = template.request(
+                
"rest:get:bw-web-api/v1/objects/timesheets?companyId=RD&select=personId,personName",
+                exchange -> exchange.getIn().setBody("Hello World"));
+        assertNotNull(result);
+        assertFalse(result.isFailed(), "Request with select parameter should 
complete without failure");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Addressed — the route processor now sets a `"validated"` response body after 
all header assertions pass, and the test verifies `assertEquals("validated", 
result.getMessage().getBody(String.class))`. This proves the processor executed 
fully past all select/companyId/filter validations.



##########
components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerEncodingTest.java:
##########
@@ -16,24 +16,34 @@
  */
 package org.apache.camel.component.undertow.rest;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.undertow.BaseUndertowTest;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-public class RestUndertowProducerEncodingTest extends BaseUndertowTest {
+class RestUndertowProducerEncodingTest extends BaseUndertowTest {
 
     @Test
-    public void testSelect() {
-        
template.sendBody("rest:get:bw-web-api/v1/objects/timesheets?companyId=RD&select=personId,personName",
 "Hello World");
+    void testSelect() {
+        Exchange result = template.request(
+                
"rest:get:bw-web-api/v1/objects/timesheets?companyId=RD&select=personId,personName",
+                exchange -> exchange.getIn().setBody("Hello World"));
+        assertNotNull(result);
+        assertFalse(result.isFailed(), "Request with select parameter should 
complete without failure");
     }
 
     @Test
-    public void testFilter() {
-        
template.sendBody("rest:get:bw-web-api/v1/objects/timesheets?companyId=RD&select=personId,personName"
-                          + "&filter=date(time/date) ge 2020-06-01 and 
personId eq 'R10019'",
-                "Bye World");
+    void testFilter() {
+        Exchange result = template.request(
+                
"rest:get:bw-web-api/v1/objects/timesheets?companyId=RD&select=personId,personName"
+                                           + "&filter=date(time/date) ge 
2020-06-01 and personId eq 'R10019'",
+                exchange -> exchange.getIn().setBody("Bye World"));
+        assertNotNull(result);
+        assertFalse(result.isFailed(), "Request with filter parameter should 
complete without failure");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Addressed — same approach: the processor sets `"validated"` after all 
assertions (including the filter check) pass, and the test verifies the 
response body.



##########
components/camel-xslt-saxon/src/test/java/org/apache/camel/component/xslt/PayloadWithDefaultNamespaceTest.java:
##########
@@ -35,7 +37,8 @@ public void configure() {
     }
 
     @Test
-    public void testTransformWithDefaultNamespace() {
-        template.sendBody("direct:start", PAYLOAD);
+    void testTransformWithDefaultNamespace() {
+        Object result = template.requestBody("direct:start", PAYLOAD);
+        assertNotNull(result, "XSLT transformation with default namespace 
should produce output");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   Addressed — the test now retrieves the result as a `String` and verifies it 
contains the expected XSLT output elements (`"transformed"` and `"cheese"` from 
the transform.xsl stylesheet).



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