This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch CAMEL-23214-port-misc
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 663f8ed563f89bc643bc6321c9b477d3b87b5b4f
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Mar 20 07:01:50 2026 +0100

    CAMEL-23214: Fix WhatsAppWebhookTest port assignment
    
    The port assignment was removed without replacement, causing the test
    to use port 0 (defaulting to 80). Add @RegisterExtension Port field.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../org/apache/camel/component/whatsapp/WhatsAppWebhookTest.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppWebhookTest.java
 
b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppWebhookTest.java
index 073f7f74e0f1..a07693a639fc 100644
--- 
a/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppWebhookTest.java
+++ 
b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppWebhookTest.java
@@ -24,12 +24,15 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.webhook.WebhookConfiguration;
 import org.apache.camel.component.webhook.WebhookEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
 import org.assertj.core.api.Assertions;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 public class WhatsAppWebhookTest extends WhatsAppTestSupport {
 
-    private int port;
+    @RegisterExtension
+    AvailablePortFinder.Port port = AvailablePortFinder.find();
 
     @Test
     public void testWebhookRegistration() throws Exception {
@@ -89,7 +92,7 @@ public class WhatsAppWebhookTest extends WhatsAppTestSupport {
     }
 
     protected WhatsAppApiConfig getWhatsAppApiConfig() {
-        return WhatsAppApiConfig.mock(port);
+        return WhatsAppApiConfig.mock(port.getPort());
     }
 
     @Override
@@ -97,7 +100,7 @@ public class WhatsAppWebhookTest extends WhatsAppTestSupport 
{
         return new RouteBuilder() {
             @Override
             public void configure() {
-                restConfiguration().host("localhost").port(port);
+                restConfiguration().host("localhost").port(port.getPort());
 
                 from("webhook:whatsapp:" + phoneNumberId + 
"?webhookAutoRegister=false").id("webhook")
                         .convertBodyTo(String.class).to("mock:endpoint");

Reply via email to