I have an Apache Camel application, which uses a Choice with a Predicate. How can I test the predicate without an integration test?
Code
@SpringBootApplication
public class TestApplication {
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}
@Bean
public EndpointRouteBuilder route() {
return new EndpointRouteBuilder() {
@Override
public void configure() throws Exception {
from(file("d:/tmp/camel/"))
.choice()
.when(jsonpath("$[?(@.status == 0)]"))
.log("ok")
.otherwise()
.log("not ok");
}
};
}
}
Research
I read Test JUnit5, but it looks like an integration test. However, I don't want to test a full route.
I read Test Spring JUnit5, but it is an integration test.
Question
How can I extract the predicate jsonpath("$[?(@.status == 0)]") and test it isolated in an unit test with JUnit 5?