如何在CamelSpringBootTest中启动CamelContext之前模拟Apache Camel Route.



可能是一个相当不常见的问题,但我想模拟某些Camel路由,在JUnit设置方法

@BeforeEach
void setUp() {
}

@Override
public void configure() throws Exception {
}

执行,当CamelContextautowired的

@Autowired
protected CamelContext camelContext;

我需要做些什么来防止自动启动Camel上下文,以便能够在setup方法中模拟我的路由并手动启动它?

您可以在单元测试中用启用通知-然后您需要手动启动Camel。

https://camel.apache.org/manual/advice-with.html _enabling_advice_during_testing

最新更新