Mock objects in Junit test gives NoClassDefFoundError

Gowtham Murugesan picture Gowtham Murugesan · Mar 27, 2015 · Viewed 9.8k times · Source

When I mock objects in Junit test cases using of PowerMock and Mockito, I'm getting this exception:

java.lang.NoClassDefFoundError: org/mockito/exceptions/base/MockitoSerializationIssue

Answer

Peter Isberg picture Peter Isberg · Jul 22, 2015

I got this when combining PowerMock with Mockito. Fixed by using compatible version as shown here: https://github.com/powermock/powermock/wiki/Mockito#supported-versions