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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 8f07c781d1a2 CAMEL-22874: Added unit test
8f07c781d1a2 is described below

commit 8f07c781d1a2870668e7f9a7aa2cee16c0fbe409
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Feb 7 10:35:35 2026 +0100

    CAMEL-22874: Added unit test
---
 .../vertx/RestOpenApiOnExceptionIssueTest.java     | 42 +++++++++++++++++-----
 1 file changed, 34 insertions(+), 8 deletions(-)

diff --git 
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/RestOpenApiOnExceptionIssueTest.java
 
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/RestOpenApiOnExceptionIssueTest.java
index d306338835b2..ac0bc327aed3 100644
--- 
a/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/RestOpenApiOnExceptionIssueTest.java
+++ 
b/components/camel-platform-http-vertx/src/test/java/org/apache/camel/component/platform/http/vertx/RestOpenApiOnExceptionIssueTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.platform.http.vertx;
 
 import io.restassured.RestAssured;
 import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.DefaultCamelContext;
@@ -29,25 +28,42 @@ import org.junit.jupiter.api.Test;
 
 import static io.restassured.RestAssured.given;
 
-@Disabled("CAMEL-22874")
 public class RestOpenApiOnExceptionIssueTest extends CamelTestSupport {
 
     @Test
-    public void testOnException() throws Exception {
+    public void testOnExceptionHandledTrue() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                onException(Exception.class)
+                        .log("Error processing request: ${exception.message}")
+                        .to("mock:error")
+                        .handled(true);
+
+                
rest().openApi().specification("openapi-v3.json").missingOperation("ignore");
+
+                from("direct:getPetById").routeId("directRoute")
+                        .process(e -> {
+                            throw new RuntimeException("Simulated error get 
pet");
+                        });
+            }
+        });
+
         getMockEndpoint("mock:error").expectedMessageCount(1);
 
         given()
                 .when()
                 .get("/api/v3/pet/1")
                 .then()
-                .statusCode(500);
+                .statusCode(204);
 
         MockEndpoint.assertIsSatisfied(context);
     }
 
-    @Override
-    protected RoutesBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
+    @Test
+    @Disabled
+    public void testOnExceptionHandledFalse() throws Exception {
+        context.addRoutes(new RouteBuilder() {
             @Override
             public void configure() throws Exception {
                 onException(Exception.class)
@@ -62,7 +78,17 @@ public class RestOpenApiOnExceptionIssueTest extends 
CamelTestSupport {
                             throw new RuntimeException("Simulated error get 
pet");
                         });
             }
-        };
+        });
+
+        getMockEndpoint("mock:error").expectedMessageCount(1);
+
+        given()
+                .when()
+                .get("/api/v3/pet/1")
+                .then()
+                .statusCode(500);
+
+        MockEndpoint.assertIsSatisfied(context);
     }
 
     @Override

Reply via email to