= Camel Quarkus 3.36.0 Migration Guide

The following guide outlines how to adapt your code to changes that were made in Camel Quarkus 3.36.0.

== CamelQuarkusTestSupport - AdviceWith improvements

The testing framework has been significantly improved to make AdviceWith easier to use and more reliable.

=== Automatic route starting after advice

Routes that are not advised are now automatically started after `doBeforeEach()` or `@BeforeEach` completes. This means you no longer need to manually call `startRouteDefinitions()` when using AdviceWith.

**Before (3.35.0 and earlier):**
[source,java]
----
@BeforeEach
public void beforeEach() throws Exception {
    AdviceWith.adviceWith(context, "my-route", route -> {
        route.weaveByToUri("kafka:*").replace().to("mock:result");
    });

    // Required to start non-advised routes
    startRouteDefinitions();
}
----

**After (3.36.0):**
[source,java]
----
@BeforeEach
void beforeEach() throws Exception {
    AdviceWith.adviceWith(this.context, "my-route", route -> {
        route.weaveByToUri("kafka:*").replace().to("mock:result");
    });

    // startRouteDefinitions() is no longer needed - auto-start handles this
}
----

=== New adviceRoute() helper method

A new `adviceRoute()` helper method has been added to simplify per-test-method advice. This method handles route lifecycle (stop, advice, start) automatically.

**Example:**
[source,java]
----
@Test
void testWithDifferentAdvice() throws Exception {
    adviceRoute("my-route", route -> {
        route.weaveByToUri("kafka:*").replace().to("mock:stub");
    });

    // Test assertions...
}
----

This is particularly useful when different tests in the same class need different advice applied.

=== Automatic advice cleanup

Advice modifications are now automatically cleaned up between test methods to prevent interference between tests. This ensures that each test starts with a clean route state.

For more details, see the xref:user-guide/testing.adoc#_using_advicewith[Testing guide].
