gpt4 book ai didi

java - 使用 MUnit 排除子流

转载 作者:行者123 更新时间:2023-11-29 06:54:41 25 4
gpt4 key购买 nike

有没有办法让我使用 MUnit 结束测试并在调用子流程时添加断言?我想将测试分成更小的部分。

最佳答案

您将不得不模拟子流程的结果。

为此,您必须使用 MUnit 中的 Mock 组件。

它的作用是,一旦调用子流/流引用,您将必须定义预期输出。

这是一个简单的例子:

        <mock:when messageProcessor=".*:.*" doc:name="Mock Get Email Recipient">
<mock:with-attributes>
<mock:with-attribute name="doc:name" whereValue="#['getEmailRecipient']"/>
</mock:with-attributes>
<mock:then-return payload="hello@gmail.com" mimeType="text/plain"/>
</mock:when>

它的作用是模拟 getEmailRecipient 流程以在测试中调用它时返回静态值 hello@gmail.com

关于java - 使用 MUnit 排除子流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36957926/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com