<mock:when messageProcessor="mule:set-payload">
<mock:with-attributes>
<mock:with-attribute name="doc:name" whereValue="#['Hello world!']" />
</mock:with-attributes>
<mock:then-return payload="#['mocked_payload']">
<mock:invocation-properties>
<mock:invocation-property key="property_name" value="#['property_value']"/>
</mock:invocation-properties>
<mock:inbound-properties>
<mock:inbound-property key="property" value="#['propertyValue']"/>
</mock:inbound-properties>
<mock:outbound-properties>
<mock:outbound-property key="property" value="#['propertyValue']"/>
</mock:outbound-properties>
</mock:then-return>
</mock:when>
Mock Processor
-
The name of the processor has changed from when to mock-when.
-
The attribute messageProcessor has change to processor.
-
In the child node with attribute the attribute name has changed to attributeName.
-
In the child node then-return the attribute payload must now be a child node.
-
The child node invocation-properties has changed variables.
-
We’ve added support for session properties, attributes, errors.
Mock Processor Syntax for MUnit 1.x
Mock Processor Syntax for MUnit 2.x
<munit-tools:mock-when processor="mule:set-payload">
<munit-tools:with-attributes>
<munit-tools:with-attribute attributeName="value" whereValue="#['Hello world!']"/>
</munit-tools:with-attributes>
<munit-tools:then-return>
<munit-tools:payload value="#['expectedPayload']"/>
<munit-tools:attributes value=""/>
<munit-tools:error id="" exception=""/>
<munit-tools:variables>
<munit-tools:variable key="#['aVariable']" value="#['aVariableValue']"/>
</munit-tools:variables>
<munit-tools:session-properties>
<munit-tools:property key="#['aSessionProperty']" value="#['aSessionPropertyValue']"/>
</munit-tools:session-properties>
<munit-tools:inbound-properties>
<munit-tools:property key="#['aInboundProperty']" value="#['aInboundPropertyValue']"/>
</munit-tools:inbound-properties>
<munit-tools:outbound-properties>
<munit-tools:property key="#['aOutboundProperty']" value="#['aOutboundPropertyValue']"/>
</munit-tools:outbound-properties>
<munit-tools:inbound-attachments>
<munit-tools:attachment key="#['aInboundAttachment']" value="#['aInboundAttachmentValue']"/>
</munit-tools:inbound-attachments>
<munit-tools:outbound-attachments>
<munit-tools:attachment key="#['aOutboundAttachment']" value="#['aOutboundAttachmentValue']"/>
</munit-tools:outbound-attachments>
</munit-tools:then-return>
</munit-tools:mock-when>