title: Mule Munit Test cases not running from Maven command line
body: <p>I have written an Munit test for one of my flows where database insertion is there. Below is the flow:</p>
  
  <pre><code>&lt;sub-flow name="AddCustomerSubFlow"&gt;
          &lt;json:json-to-object-transformer returnClass="java.lang.Object" doc:name="JSON to Object"/&gt;
          &lt;set-variable variableName="originalPayload" value="#[payload]" doc:name="saveOriginalPayload" /&gt;
          &lt;db:insert config-ref="MySQL_Configuration" doc:name="insertCustomer" autoGeneratedKeys="true" autoGeneratedKeysColumnIndexes="1"&gt;
              &lt;db:parameterized-query&gt;
              &lt;![CDATA[INSERT INTO CUSTOMER (
                  NAME,
                  AGE,
                  LINE1,
                  LINE2,
                  CITY,
                  STATE,
                  PINCODE 
              ) VALUES (
                  #[payload.customer.name],
                  #[payload.customer.age],
                  #[payload.customer.address.line1],
                  #[payload.customer.address.line2],
                  #[payload.customer.address.city],
                  #[payload.customer.address.state],
                  #[payload.customer.address.pincode]
              )]]&gt;
              &lt;/db:parameterized-query&gt;
          &lt;/db:insert&gt;
          &lt;dw:transform-message doc:name="buildResponse"&gt;
              &lt;dw:set-payload&gt;
              &lt;![CDATA[%dw 1.0
                  %input payload application/java
                  %output application/json
                  ---
                  {
                      "customer": {
                          "id": payload[0].generated_key,
                          "name": flowVars.originalPayload.customer.name,
                          "age": flowVars.originalPayload.customer.age,
                          "address": {
                              "line1": flowVars.originalPayload.customer.address.line1,
                              "line2": flowVars.originalPayload.customer.address.line2,
                              "city": flowVars.originalPayload.customer.address.city,
                              "state": flowVars.originalPayload.customer.address.state,
                              "pincode": flowVars.originalPayload.customer.address.pincode
                          }
                      }
                  }]]&gt;
              &lt;/dw:set-payload&gt;
          &lt;/dw:transform-message&gt;
          &lt;logger message="#[payload]" level="INFO" doc:name="logPayload"/&gt;
  &lt;/sub-flow&gt;
  </code></pre>
  
  <p>And test case is:</p>
  
  <pre><code>&lt;munit:config name="munit" doc:name="MUnit configuration" /&gt;
  &lt;spring:beans&gt;
      &lt;spring:import resource="classpath:AddCustomerSubFlow.xml" /&gt;
      &lt;spring:import resource="classpath:GlobalElements.xml" /&gt;
  &lt;/spring:beans&gt;
  &lt;munit:test name="AddCustomerSubFlowTest" description="To test the creation new Customer"&gt;
      &lt;mock:when messageProcessor=".*:.*" doc:name="mockDBInsert"&gt;
          &lt;mock:with-attributes&gt;
              &lt;mock:with-attribute name="doc:name" whereValue="#['insertCustomer']" /&gt;
          &lt;/mock:with-attributes&gt;
          &lt;mock:then-return payload="#[[[&amp;quot;generated_key&amp;quot;: 1]]]" /&gt;
      &lt;/mock:when&gt;
      &lt;munit:set payload="#[getResource(&amp;quot;examples/customer_post_request.json&amp;quot;).asString()]" doc:name="setRequestMsg" /&gt;
      &lt;flow-ref name="AddCustomerSubFlow" doc:name="invokeAddCustomerSubFlow" /&gt;
      &lt;mock:verify-call messageProcessor=".*:.*" doc:name="verifyDBInsert"&gt;
          &lt;mock:with-attributes&gt;
              &lt;mock:with-attribute name="doc:name" whereValue="#['insertCustomer']" /&gt;
          &lt;/mock:with-attributes&gt;
      &lt;/mock:verify-call&gt;
      &lt;object-to-string-transformer doc:name="Object to String" /&gt;
      &lt;json:json-to-object-transformer returnClass="java.lang.Object" doc:name="JSON to Object" /&gt;
      &lt;munit:assert-on-equals expectedValue="#[1]" actualValue="#[payload.customer.id]" doc:name="assertId" /&gt;
  &lt;/munit:test&gt;
  </code></pre>
  
  <p>The test case is running fine in the Studio. But when I am trying to run this test case from maven command line using <code>mvn clean test</code>, there was an error:</p>
  
  <pre><code>Caused by: org.mule.api.config.ConfigurationException: Configuration problem: Failed to import bean definitions from URL location [classpath:AddCustomerSubFlow.xml]
  Offending resource: URL [file:/D:/codebase/mule/sunguard-session/target/test-classes/AddCustomerSubFlowTest.xml]; nested exception is org.springframework.beans.factory.xm
  l.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [AddCustomerSubFlow.xml] is invalid; nested exception is org.xml.sax.SAXParseException
  ; lineNumber: 14; columnNumber: 133; cvc-complex-type.2.4.a: Invalid content was found starting with element 'db:insert'. One of '{"http://www.mulesoft.org/schema/mule/co
  re":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-outbound-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-m
  essage-processor}' is expected. (org.mule.api.lifecycle.InitialisationException)
  </code></pre>
  
  <p>Can anyone please solve the problem?</p>