jamesnetherton commented on issue #4000:
URL: https://github.com/apache/camel-quarkus/issues/4000#issuecomment-1217520768

   It's a bit tricky to accomplish at the moment. There's some new 
functionality that'll be part of the upcoming 2.12.0 release which will mimic 
`CamelTestSupport`. It'll take take care of this scenario for you.
   
   For now, you can either add the routes on a per test basis and remove them 
when testing is complete. E.g something like:
   
   ```java
   @Test
   public void testSomething() {
       camelContext.addRoutes(new RouteBuilder() {
           public void configure() {
               from("direct:start").id("my-route").to("log:end");
           }
       });
   
       try {
           // Your test logic here
       } finally {
           // Could also be done in @AfterEach
           camelContext.removeRoute("my-route");
       }    
   }
   ```
   
   The alternative is to use Quarkus [test 
profiles](https://quarkus.io/guides/getting-started-testing#testing_different_profiles).
 The application will get stopped / started for each profile, so you'll have a 
'reset' `CamelContext`. But it comes at the cost of the time required to 
restart the application under test. 


-- 
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: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to