We have a Spring Integration route using a Router with an expression. This expression is set in the yml file. I would like to create unit tests setting manually the value for this router attribute, but it doesn't seem to work.
Test
@Autowired
EventDrivenConsumer myrouter;
.....
((ExpressionEvaluatingRouter) myrouter.getHandler()).setPrimaryExpression(new SpelExpressionParser().doParseExpression("true"));
Part of the XML context
<int:router input-channel="catchweightExcluderChannel" expression="${rip.config.exclude_catchweight}" default-output-channel="productTransformerChannel">
<int:mapping value="true" channel="catchWeightFilteringChannel" />
<int:mapping value="false" channel="productTransformerChannel" />
</int:router>
But it seems my value overrided is not affecting the behaviour...it seems as once Spring reads the context, changing attributes of components does not affect their behaviour.