I am trying to Unit test one of my sub-flows using MUnit, I need to mock out a custom Java component but I am unable to do so.
My sub-flow reads as below
So there is no problem with your mock it actually work perfectly. The problem is with Mule and a little bit with MUnit.
Short answer, there is no fix for that right now. There is a workaround though!
Create a new xml (as to keep it separate from your production code) Add flow (not a sub-flow) to that new xml. In the flow you just added do a flow-ref to your sub-flow. From you test, instead of doing runFlow(PROCESS_CSV_FLOW), do runFlow("the_flow_you_created").
The longer answer is:
The sub-flows are not real flows, they don't even share a parent class. Thus they behave a little bit different. MUnit does some stuff to make that fact transparent to the user.
As it turns out we are not making enough, I'll create a jira in the MUnit project to tackle that issue. But hopefully you should be able to keep testing.