I've put together a test class (http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html#13)
|List list = new LinkedList();
|List spy = spy(list);
|
|// using the spy calls real methods
|spy.add("one");
|spy.add("two");
Trying to run this yields :
|java.lang.RuntimeException: Unable to set MockitoNamingPolicy on cglib generator which creates FastClasses
|at org.mockito.internal.creation.cglib.CGLIBHacker.setMockitoNamingPolicy(CGLIBHacker.java:29)
|at org.mockito.internal.creation.MethodInterceptorFilter.intercept(MethodInterceptorFilter.java:42)
|at $java.util.LinkedList$$EnhancerByMockitoWithCGLIB$$440d9615.add(<generated>)
|at testSpy.spying(testSpy.java:17)
|Caused by: java.lang.NullPointerException
|at org.mockito.internal.creation.cglib.CGLIBHacker.setMockitoNamingPolicy(CGLIBHacker.java:23)</generated>
Browsing the changes in cglib, I traced this down to the
MethodProxy.java class, particularly this change:
http://cglib.cvs.sourceforge.net/viewvc/cglib/cglib/src/proxy/net/sf/cglib/proxy/MethodProxy.java?r1=1.14&r2=1.15
"createInfo = null;"
It seems to be a fix for #28 (http://sourceforge.net/p/cglib/bugs/28/)