1

I'm trying to partially mock a class from a signed Jar file (actually, the target class is in the Eclipse API).

Is there any way to do that with Mockito? I tried out several workarounds, but the result is always something like this:

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
    ...

A Bit of Googling showed me that PowerMock might help me, but I would like to avoid introducing a new dependency for my project.

Thanks in advance!

4

1 回答 1

2

我相信 CGLIB 已经过调整以支持签名包,但可能存在一些问题。你能做一个简单的项目来演示问题并在 mockito 项目上打开一个问题吗?

你在 OSGI 中运行模拟吗?

布莱斯

于 2012-06-14T13:15:16.113 回答