如何在 mule munit 中模拟任意点 mq

How to mock anypoint mq in mule munit

我的项目有一个 Anypoint MQ 连接器 - 我想通过 munit 测试来模拟它,有人可以告诉我如何模拟它吗

我是这样操作的

 <mock:when messageProcessor="anypoint-mq:publish" doc:name="Mock Anypoint MQ">
            <mock:with-attributes>
                <mock:with-attribute name="doc:name" whereValue="#['Anypoint MQ']"/>
            </mock:with-attributes>
            <mock:then-return payload="#['Message publised successfully.']"/>
        </mock:when>

试试这个方法 -

 <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。