When I try to Spy an object in my unit test, I got an exception. This is my unit test file:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loc
In the release 2.0.32-beta Mockito team moved cglib classes into separated jar. But PowerMock still depends on classes which have been moved, so you get java.lang.NoClassDefFoundError.
In release 1.6.2 Mockito classes was copied into PowerMock, but not all. As workaround I may suggest clone, build and add to classpath the mockito-cglib (https://github.com/mockito/mockito-cglib).
The PowerMock will have supported Mockito 2 API since 1.6.5 which will have been released by the end of the May, but will still use cglib. The full Mockito 2 with Bytebuddy will be supported in release after 1.6.5.
Developer Guide for Migration to Mockito 2