【发布时间】:2012-06-14 21:15:16
【问题描述】:
我正在尝试从已签名的 Jar 文件中部分模拟一个类(实际上,目标类在 Eclipse API 中)。
有没有办法用 Mockito 做到这一点?我尝试了几种解决方法,但结果总是这样:
org.mockito.cglib.core.CodeGenerationException:
java.lang.reflect.InvocationTargetException-->null
...
Caused by: java.lang.reflect.InvocationTargetException
...
Caused by: java.lang.SecurityException:
class "org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate$$
FastClassByMockitoWithCGLIB$$6e308a80"'s
signer information does not match signer information of other classes
in the same package
...
一点谷歌搜索告诉我PowerMock might help me,但我想避免为我的项目引入新的依赖项。
提前致谢!
【问题讨论】:
标签: testing mocking eclipse-rcp mockito