Search code examples
mulemunit

Spy and verifyCallOf message processors for flow-ref in munit


Can a spy or verifyCallOf message processors be used on flow-ref? We have a flow as follows:

<flow name="myMainFlow">
    ........
    ........
    <flow-ref name="mySubFlow" />
</flow>

<sub-flow>
    ...
</sub-flow>

I am unable to use spy or verifyCallOf on flow-ref calls. But I am able to use them on the message processors inside sub-flow. Is there a way I can achieve this?


Solution

  • You mock the FLOW or sub flow not the flow-ref

    https://github.com/mulesoft/munit/blob/munit-3.5.x/munit-integration-tests/src/test/munit/mp-mocking-test.xml#L321

    https://github.com/mulesoft/munit/blob/munit-3.5.x/munit-integration-tests/src/test/munit/mp-mocking-test.xml#L338