I am doing integration testing on the Camel route.
The Camel route:
from("direct:abc")
.routeId("abc-route")
.process(MyProcessor())
.toD("direct:xyz")
As this route is getting tested into isolation, I need to set headers in the test; previously, they arrived from another route. How can I do it?
Simplified test class:
@SpringBootTest
@MockEndpoints
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
class MyRouteTest {
@Autowired
lateinit var camelContext: CamelContext
@Produce(uri = "direct:abc")
lateinit var template: ProducerTemplate
@EndpointInject(uri = "mock:direct:xyz")
lateinit var destEndpoint: MockEndpoint
@Test
fun `should test route`() {
template.sendBody("")
}
}
I have tried doing camelContext.adapt(ModelCamelContext::class.java) but still cannot get to the route and forcibly modify it.