<munit:test name="sampleTest" description="Test">
<mock:when messageProcessor="mule:set-payload">
<mock:then-return payload="#['Sample']"/>
</mock:when>
<flow-ref name="sampleFlow"/>
<munit:assert-payload-equals expectedValue="#['SampleString']"/>
</munit:test>
Migrating Test Structure (MUnit)
The MUnit test is divided into three scopes. All of them are optional:
Scope | Description |
---|---|
Behavior |
The behavior scope ( |
Execution |
The execution scope ( |
Validation |
The validation scope ( |
The following examples compare MUnit tests in 1.x to 2.x.
<munit:test name="sampleTest" description="Test">
<munit:behavior>
<munit-tools:mock-when processor="mule:set-payload">
<munit-tools:then-return>
<munit-tools:payload value="#['Sample']" />
</munit-tools:then-return>
</munit-tools:mock-when>
</munit:behavior>
<munit:execution>
<flow-ref name="sampleFlow"/>
</munit:execution>
<munit:validation>
<munit-tools:assert-that expression="#[payload]" is="#[MunitTools::equalTo('SampleString')]"/>
</munit:validation>
</munit:test>