Reputation: 21
I want to use the Assert Equals component to find if a string exists in my payload. I give an example:
Txt|Name=ST CLAUD|Country=SPAIN|Txtld=45
I want to search if the payload contains the string "SPAIN" Is there a mule expression MEL to do that?
Thank you in advance
Upvotes: 1
Views: 10582
Reputation: 2694
you should use Assert True instead of Assert Equals and use the contains
method defined in java.lang.Stirng
(assumed payload is of type String!).
example:
<munit:test name="dataweaveTest" description="MUnit Test">
<munit:set payload="Txt|Name=ST CLAUD|Country=SPAIN|Txtld=45" doc:name="Set Message"/>
<munit:assert-true doc:name="Assert True"
condition="#[payload.contains('SPAINA')]" />
</munit:test>
here is what it looks like in AnypointStudio:
Upvotes: 1