`

java.lang.NoClassDefFoundError: org/objenesis/ObjenesisStd

阅读更多

解决方案收集,可行 
ClassNotFoundException is result of a class loader that is not able to load a particular class.

In your case Mockito has a transitive dependency to Objenesis (it needs Objenesis for correct behavior). You are most likely trying to execute your test with Mockito on test class path, but without Objenesis.

You need to add Objenesis to your test class path.

For maven projects, be sure that:

you have declared Mockito as test dependency
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-core</artifactId>
    <version>1.10.19</version>
    <scope>test</scope>
</dependency>
to run a particular test from the command line execute
mvn test -Dtest=fullyQualifedNameToYourTestClass
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics