小编Gre*_*vis的帖子

在项目中使用mockito-inline会抛出“Mockito无法模拟此类”错误

我在我的项目中使用 Mockito 2.23.4 和 byte-buddy 1.9.3。我想模拟最终类和方法,所以我在这篇文章Mockito 模拟最终类和方法以及项目目录中的mock-maker-inline内部文件设置之后使用了mockito-inline 。我还跟进了Mockito 因无效参数名称异常而启用内联模拟而失败的帖子,但问题仍然存在。但是当我运行测试时,我得到下面的堆栈跟踪。org.mockito.plugins.MockMakersrc/test/resources/mockito-extensions

Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

Test ignored.

org.mockito.exceptions.base.MockitoException: 
Mockito cannot mock this class: class org.elasticsearch.client.RestHighLevelClient.

If you're not sure why you're getting this error, please report to the mailing list.


Java               : 15
JVM vendor name    : Oracle Corporation
JVM vendor version : 15.0.2+7-27
JVM name           : Java …
Run Code Online (Sandbox Code Playgroud)

java junit unit-testing mockito byte-buddy

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

byte-buddy ×1

java ×1

junit ×1

mockito ×1

unit-testing ×1