mockito

 

项目中引入 mockito,报错:

java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)

解决:

https://howtodoinjava.com//plugin-mockmaker-error/

 

<!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.5.1</version>
<scope>test</scope>
</dependency>

依赖

<!-- https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.12.9</version>
</dependency>

 

使用

Resolving Mockito Exception: Wanted But Not Invoked
https://www.baeldung.com/mockito-exception-wanted-but-not-invoked

 

在 Spring 中使用 Mockito 进行单元测试
https://zhuanlan.zhihu.com/p/340169921

 

在SpringTest中将Mockito的mock对象通过spring注入使用
————————————————
版权声明:本文为CSDN博主「试水流连」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/m0_38043362/article/details/80111957
https://blog.csdn.net/m0_38043362/article/details/80111957

posted @ 2023-10-22 12:39  parkdifferent  阅读(355)  评论(0编辑  收藏  举报