簡體   English   中英

如何在 MUnit 中使用“Mock When”來模擬“MuleSoft Anypoint Exchange”自定義 API 連接器?

[英]How to mock "MuleSoft Anypoint Exchange" Custom API Connector using "Mock When" in MUnit?

我正在為 Proc 層實現流程編寫 Munit,它使用 Exchange API 連接器調用系統層 POST 端點(系統層 RAML 在 Exchange 中發布以生成其連接器)。 當我為 API 連接器添加“模擬時間”時,它不會模擬連接器並嘗試調用實際的 API 端點。

我通過提供處理器和 doc:id 和 doc:name 的 API 連接器嘗試了“模擬時間”。

以下是我的 API 連接器 XML 代碼

<ol-smart-sys-property:create-announcement-by-code doc:name="Create announcement by code" doc:id="88b6e101-5999-4b11-b2ed-aeaee9ae5bd4" code="#[vars.code]" config-ref="Ol_smart_sys_property_Config"/>

以下是Mock when XML 代碼

<munit-tools:mock-when doc:name="Mock when" doc:id="8421e6fc-564e-44ea-94fe-78edbd1a979d" processor="ol-smart-sys-property:create-announcement-by-code">
    <munit-tools:with-attributes >
        <munit-tools:with-attribute attributeName="doc:id" whereValue="88b6e101-5999-4b11-b2ed-aeaee9ae5bd4" />
    </munit-tools:with-attributes>
    <munit-tools:then-return ></munit-tools:then-return>
</munit-tools:mock-when>

刪除模擬的with-attributes部分是否有效? 我相信當前運行時中存在一個錯誤,該錯誤使基於 Raml 的連接器在指定屬性時無法被 MUnit 模擬

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM