我正在尝试从签名的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,但我想避免为我的项目引入新的依赖。
提前致谢!
答案 0 :(得分:2)
我认为CGLIB已经过调整以支持已签名的软件包,但可能存在一些问题。 你能做一个简单的项目,证明问题并在mockito项目上打开一个问题吗?
你在OSGI内部运行模拟吗?
布莱斯