You can use these properties, that are set to the SpringBootTest Annotation.
- java-routes-inlcude-pattern - Pattern to include routes in your test
- java-routes-exclude-pattern - Pattern to exclude routes in your test
These are ant style properties that search through your src folder for matching RouteBuilders
Example with pattern:
// Fix test runner
@RunWith(CamelSpringBootRunner.class)
// Your spring boot application with the main method
@SpringBootTest(classes = {SpringBootTestRunner.class},
// Finds all routes in your whole src folder that start with 'SomeRoute', e.g. SomeRouteOne
properties = {"camel.springboot.java-routes-include-pattern=**/SomeRoute*"})
public class SomeRouteOneTestCase {
... // Unit Tests
}
Example for fix class:
// Fix test runner
@RunWith(CamelSpringBootRunner.class)
// Your spring boot application with the main method
@SpringBootTest(classes = {SpringBootTestRunner.class},
// Find the RouteBuilder 'SomeRouteTwo' in the package 'com.foo.bar' and nothing more
properties = {"camel.springboot.java-routes-include-pattern=com/foo/bar/TestRouteTwo"})
public class TestRouteTwoTestCase {
... // Tests
}
java-routes-exclude-pattern works in the same way, just exluding the listed route builders.
Hope this helps.
Greets
Chris
@Component
annotation from your RouteBuilder? Without the annotation the RouteBuilder won't be discovered` – mgyongyosi