如何在骡子单位中模拟任何点 mq



我的项目有一个 Anypoint MQ 连接器 - 我想从 munit 测试中模拟它,有人可以建议如何模拟它吗

试试这种方式 -

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

如果您遇到任何问题,请再次发布。

我已经这样做了,如下所示

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

最新更新