Using the FunctionalTestCase
it should be as simple as:
MessageProcessor subFlow = muleContext.getRegistry().lookupObject("subflow_1");
MuleEvent result = subFlow.process(getTestEvent("test_data"));
but it doesn't work.
For now, the best approach IMO consists in having a test config that contains flow wrappers for the sub-flows you want to test and load this test config alongside your main config in the FunctionalTestCase
.
@genjosanzo's approach works too but it is based on associating the sub-flow with a pre-existing main-flow from test code itself. I personally think it would be stricter to create test flows instead.