title: Testing sub-flows in Mule
body: <p>I have started writing test cases to my Mule project. </p>
  
  <p>I have written the functional test case for my Main Flows as follows.</p>
  
  <pre><code>public void testMainFlow_1() throws Exception{
       MuleClient client = muleContext.getClient();
              MuleMessage result = client.send(helloServiceAddress, fileAsString("SamplePayloads/input_Request.xml"), properties);
      assertNotNull("Null Result", result);           
      assertEquals(result.getPayloadAsString(), fileAsString("SampleResponses/sampleResponse.xml"));   
  
  }
  </code></pre>
  
  <p>But how can I test my sub-flows. They don't have any end-points. So how can I pass payload to them and test it.</p>
  
  <p>Given below is my flow config.</p>
  
  <pre><code>&lt;flow name="main_flow" &gt;
      ....
      ....
      &lt;flow-ref  name="subflow_1" /&gt;
      ....
      ....
      &lt;flow-ref  name="subflow_2" /&gt;
      ....
      ....
  &lt;/flow&gt;
  
  &lt;sub-flow name="subflow_1"&gt;
      ....
      &lt;some-transformer ... /&gt;
      &lt;out-bound call to web-service /&gt;
      &lt;some-transformer ... /&gt;
      ....
  &lt;/sub-flow&gt;
  
  &lt;sub-flow name="subflow_2"&gt;
      ....
      &lt;some-transformer ... /&gt;
      &lt;out-bound call to web-service /&gt;
      &lt;some-transformer ... /&gt;
      ....
  &lt;/sub-flow&gt;
  </code></pre>