Search code examples
mockingmuleanypoint-studiomunit

How to mock anypoint mq in mule munit


my project has an Anypoint MQ connector - I want to mock it form munit testing can someone please advise how to mock it


Solution

  • Try this way -

     <mock:when messageProcessor=".*:.*" doc:name="Mock_Anypoint_MQ">
             <mock:with-attributes>
                 <mock:with-attribute name="doc:name" whereValue="#['abc']"/>
             </mock:with-attributes>
             <mock:then-return payload="#['Message Published!']"/>
     </mock:when>
    

    Post again if you are facing any issue.