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

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

commit 61f033d5284cfcf8fdc917f8384c9fe7e97f0eb0
Author: James Netherton <[email protected]>
AuthorDate: Fri Nov 20 14:12:52 2026 +0000

    Fix CamelQuarkusTestSupport documentation to match the current API
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../testing/camel-quarkus-test-support.adoc        | 38 ++++++++++++++--------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git 
a/docs/modules/ROOT/pages/user-guide/testing/camel-quarkus-test-support.adoc 
b/docs/modules/ROOT/pages/user-guide/testing/camel-quarkus-test-support.adoc
index 6f11063b720..588701e7c81 100644
--- a/docs/modules/ROOT/pages/user-guide/testing/camel-quarkus-test-support.adoc
+++ b/docs/modules/ROOT/pages/user-guide/testing/camel-quarkus-test-support.adoc
@@ -3,7 +3,7 @@
 If you used Camel standalone or on other runtimes before, you may know 
`CamelTestSupport` already.
 The original `CamelTestSupport` class is not well suited to Quarkus, so 
there's an extended Quarkus friendly version called `CamelQuarkusTestSupport`.
 
-> IMPORTANT: `CamelQuarkusTestSupport` only works in JVM mode. If you need to 
test in native mode, then use one of the alternate test strategies described in 
the xref:user-guide/testing.adoc[Testing] guide.
+IMPORTANT: `CamelQuarkusTestSupport` only works in JVM mode. If you need to 
test in native mode, then use one of the alternate test strategies described in 
the xref:user-guide/testing.adoc[Testing] guide.
 
 To use `CamelQuarkusTestSupport`, you must add `camel-quarkus-junit` as a test 
scoped dependency to your application.
 
@@ -19,10 +19,10 @@ To use `CamelQuarkusTestSupport`, you must add 
`camel-quarkus-junit` as a test s
 == Customizing the `CamelContext` for testing
 
 You can customize the `CamelContext` for testing with 
https://quarkus.io/guides/config-reference#profiles[configuration profiles], 
CDI beans, observers, 
https://quarkus.io/guides/getting-started-testing#mock-support[mocks] etc.
-You can also override the `createCamelContext` method and interact directly 
with the `CamelContext`.
+You can also override the `camelContextSupplier` method and interact directly 
with the `CamelContext`.
 
-IMPORTANT: When using `createCamelContext` you *MUST NOT*  instantiate and 
return a new `CamelContext`. Instead, invoke `super.createCamelContext()` and 
modify the returned `CamelContext` as needed.
-Failing to follow this rule will result in an exception being thrown.
+IMPORTANT: When overriding `camelContextSupplier` you *MUST NOT* instantiate 
and return a new `CamelContext`. Instead, invoke `super.camelContextSupplier()` 
and modify the returned `CamelContext` as needed.
+Failing to follow this rule will cause your tests to fail.
 
 [source,java]
 ----
@@ -30,9 +30,9 @@ Failing to follow this rule will result in an exception being 
thrown.
 class SimpleTest extends CamelQuarkusTestSupport {
 
     @Override
-    protected CamelContext createCamelContext() throws Exception {
+    protected CamelContext camelContextSupplier() throws Exception {
         // Must call super to get a handle on the application scoped 
CamelContext
-        CamelContext context = super.createCamelContext();
+        CamelContext context = super.camelContextSupplier();
         // Apply customizations
         context.setTracing(true);
         // Return the modified CamelContext
@@ -98,8 +98,7 @@ For example, to define a test profile:
 
 [source,java]
 ----
-@QuarkusTest
-class MyTestProfile implements QuarkusTestProfile {
+public class MyTestProfile implements QuarkusTestProfile {
     ...
 }
 ----
@@ -307,9 +306,9 @@ Advice modifications are automatically cleaned up between 
test methods to preven
 
 == Limitations
 
-=== Test lifecycle methods inherited from `CamelTestSupport`
+=== Test lifecycle methods from `CamelTestSupport`
 
-`CamelQuarkusTestSupport` inherits some test lifecycle methods from 
`CamelTestSupport`. However, they should not be used and instead are replaced 
with equivalent methods in `CamelQuarkusTestSupport`.
+The JUnit lifecycle methods of `CamelTestSupport` are not available in 
`CamelQuarkusTestSupport`. If you are migrating tests from `CamelTestSupport`, 
use the equivalent methods in `CamelQuarkusTestSupport` instead.
 
 |===
 |CamelTestSupport lifecycle methods |CamelQuarkusTestSupport equivalent
@@ -329,7 +328,7 @@ Advice modifications are automatically cleaned up between 
test methods to preven
 
 === Creating a custom Camel registry is not supported
 
-The `CamelQuarkusTestSupport` implementation of `createCamelRegistry` will 
throw `UnsupportedOperationException`.
+`CamelQuarkusTestSupport` always uses the Camel registry of the application 
under test. Unlike `CamelTestSupport`, there is no `createCamelRegistry` method 
to override.
 
 If you need to bind or unbind objects to the Camel registry, then you can do 
it by one of the following methods.
 
@@ -346,7 +345,20 @@ public class MyBeanProducers {
 }
 ----
 +
-* Override `createCamelContext` (see example above) and invoke 
`camelContext.getRegistry().bind("foo", fooBean)`
+* Override `bindToRegistry` and invoke `registry.bind("foo", fooBean)`
++
+[source,java]
+----
+@QuarkusTest
+class SimpleTest extends CamelQuarkusTestSupport {
+    @Override
+    protected void bindToRegistry(Registry registry) throws Exception {
+        super.bindToRegistry(registry);
+        registry.bind("myBean", new MyBean());
+    }
+}
+----
++
 * Use the `@BindToRegistry` annotation
 +
 [source,java]
@@ -357,8 +369,6 @@ class SimpleTest extends CamelQuarkusTestSupport {
     MyBean myBean = new MyBean();
 }
 ----
-+
-+
 
 NOTE: Beans bound to the Camel registry from individual test classes, will 
persist for the duration of the test suite execution.
 This could have unintended consequences, depending on your test expectations. 
You can use test profiles to restart the `CamelContext` to avoid this.

Reply via email to