Use below code snippet
<api xmlns="http://ws.apache.org/ns/synapse" name="TestFilter" context="/test1">
<resource methods="POST" url-mapping="/filter">
<inSequence>
<filter xpath="$body//*[local-name()='FilterCondition']/text()">
<then>
<log>
<property name="ThenCondition" expression="."/>
</log>
</then>
<else>
<log>
<property name="ElseCondition" expression="."/>
</log>
</else>
</filter>
</inSequence>
</resource>
</api>
Try with the sample XML
<Check>
<FilterCondition>123</FilterCondition>
</Check>
So your test case should be as below
1: Use the same XML, the flow should go to then condition
.
2: Pass empty value in FilterCondition
like <FilterCondition/>
, this should go to else condition.
3: remove the tag FilterCondition
and just pass
<Check></Check>
, this should again go to else condition