@Configure
is an annotation allowing to mark a method with an arbitrary name that is meant to be called to
configure the Camel context to use for the test. Several methods in the test class and/or its parent classes can be
annotated.
Be aware that only a specific signature is supported, indeed any annotated methods must have only one parameter of
type
MainConfigurationProperties
.
In the next example, the annotation
Configure
on the method
configureRoutesBuilder
indicates the test
framework to call it while initializing the Camel context used for the test.
@CamelMainTest
class SomeTest {
@Configure
void configureRoutesBuilders(MainConfigurationProperties configuration) {
configuration.addRoutesBuilder(new SomeRouteBuilder());
}
// The rest of the test class
}
This annotation can be used in
@Nested
test classes. The configure methods of outer classes are executed
before the configure methods of inner classes.