相关疑难解决方法(0)

Mockito失败,内联的模拟启用了无效的参数名称异常

我启用了内联模拟,以便我可以模拟最终类,但现在我在使用Junit运行测试时遇到以下异常.

当我立即运行所有测试时,只有两个测试失败,但如果我单独运行测试,那么大多数测试都会失败.

我没有使用任何scala或android类(我知道).我正在使用lombok,但我尝试删除lombok注释任何它没有解决问题.

当删除mock-maker-inline时问题消失了,但我宁愿保留它.

我该如何解决这个问题?

org.mockito.exceptions.base.MockitoException: 
Mockito cannot mock this class: class com.example.MyClass.

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


Java               : 1.8
JVM vendor name    : Oracle Corporation
JVM vendor version : 25.112-b15
JVM name           : Java HotSpot(TM) 64-Bit Server VM
JVM version        : 1.8.0_112-b15
JVM info           : mixed mode
OS name            : Windows 10
OS version         : 10.0


You are seeing this disclaimer because Mockito is configured to …
Run Code Online (Sandbox Code Playgroud)

java junit mockito byte-buddy

11
推荐指数
2
解决办法
3671
查看次数

标签 统计

byte-buddy ×1

java ×1

junit ×1

mockito ×1