davsclaus commented on code in PR #21969:
URL: https://github.com/apache/camel/pull/21969#discussion_r2932649604
##########
core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ModelParserTest.java:
##########
@@ -449,6 +450,54 @@ public void testParseError() throws Exception {
assertTrue(e.getMessage().startsWith("Unexpected attribute '{}ref'"));
}
+ @Test
+ public void testMethodAfterStepsInWhenClauseShouldFail() throws Exception {
+ String routesXml = """
+ <routes xmlns="http://camel.apache.org/schema/xml-io">
+ <route>
+ <from uri="direct:start"/>
+ <choice>
+ <when>
+ <simple>${header.foo} == 'bar'</simple>
+ <log message="Condition met"/>
+ <method ref="someBean" method="processFooBar"/>
+ </when>
+ <otherwise>
+ <to uri="mock:other"/>
+ </otherwise>
+ </choice>
+ </route>
+ </routes>
+ """;
+ Exception e = assertThrows(Exception.class, () -> {
+ new ModelParser(new
StringReader(routesXml)).parseRoutesDefinition();
+ });
+ assertThat(e).hasStackTraceContaining("already has a predicate");
+ }
+
+ @Test
+ public void testMethodAsPredicateInWhenClauseShouldWork() throws Exception
{
+ String routesXml = """
+ <routes xmlns="http://camel.apache.org/schema/xml-io">
+ <route>
+ <from uri="direct:start"/>
+ <choice>
+ <when>
+ <method ref="someBean" method="isFoo"/>
+ <to uri="mock:foo"/>
Review Comment:
Would it be good to add a <bean> here as the exception message tells
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]