When searching online for strategies to test a fragment of a Camel route with JUnit5 in the context of a Spring Boot application, the returned documentation seems somewhat outdated (favouring xml instead of java config for both Spring and Camel related aspects) and missing a major point.
Some top google hits for "apache camel test spring boot" are:
One (at least me) gets drawn to the "Spring Test With Java Config" example. When rebuilding from that example in a SpringBoot app, it won't ever work because the ProducerTemplate and MockEndpoint instances remain null.
I happened to have an old working example of a project built with Camel v2.20 which had the annotation @ContextConfiguration(loader = CamelSpringDelegatingTestContextLoader.class). Adding that (and a dependency on camel-test-spring on top of camel-test-spring-junit5) made the injections work but caused an NPE at org.apache.camel.test.spring.CamelAnnotationsHandler.handleDisableJmx(CamelAnnotationsHandler.java:90) which gets fixed by adding a static method that sets a dummy test class in CamelSpringTestHelper.
After asking for assistance on gitter it was suggested to try to annotate the test class with @CamelSpring*Boot*Test instead of @CamelSpringTest as the example showed. As always with annotations: that "magically" solved all issues. There was no way I could have known it existed.
Using CamelSpringTestSupport and rolling your own implementation of an AbstractApplicationContext does not sound very attractive.
The list of examples goes further with "Plain Spring tests" but only supported by JUnit4. It is uncertain whether this has any chance to work with JUnit5.
As already stated on the page: old and needs updating. Won't comment further. This looks like the original example I built my Camel v2.20 project with, using the CamelSpringDelegatingTestContextLoader
It first suggests to extend CamelSpringTestSupport, but writing only my test config in xml does not sound appealing.
Next comes an example again using @CamelSpringTest which has identical issues as brought up in my first bullet.