Reputation: 10606
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!
Upvotes: 1
Views: 1784
Reputation: 42283
I believe CGLIB had been tweaked to support signed packages, but there might be some issues. Could you make a simple project, that demonstrate the problem and open an issue on the mockito project ?
Are you running the mocks inside OSGI ?
Brice
Upvotes: 2