gpt4 book ai didi

java - 什么是mockito-inline,它如何模拟 final方法?

转载 作者:行者123 更新时间:2023-12-03 10:03:51 29 4
gpt4 key购买 nike

Mockito中的Javadocs说-“从版本2.7.6开始,我们提供了'mockito-inline'工件,该工件无需配置MockMaker扩展文件就可以进行内联模拟。”这是什么意思?模仿内联如何工作?为什么要为Mockito-inline使用单独的工件?

最佳答案

由于我也偶然发现了这个问题,答案是buried quite deep in the docs,就在这里。
Mockito可选地提供高级模拟功能,例如模拟最终类。为此,他们使用了一种不同的机制(“模拟程序制造商”),该机制被认为是实验性的,因此默认情况下处于关闭状态。但:

As a convenience, the Mockito team provides an artifact where this mock maker is preconfigured. Instead of using the mockito-core artifact, include the mockito-inline artifact in your project.

关于java - 什么是mockito-inline,它如何模拟 final方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53274463/

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