I'm newbie with Mockito and trying to lean from Here,
All configuration I have done (Using Win-10) which mentioned in the tutorial.
Setting in Environment variable :

Mockito version :
<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>2.0.2-beta</version>
<scope>test</scope>
</dependency>
I've started with the example mentioned in the same. but while I do run the test my class it shows below exception :
Exception in thread "main" java.lang.NoClassDefFoundError: org/mockito/Mockito at com.mockitotest.PortfolioTester.setUp(PortfolioTester.java:23) at com.mockitotest.PortfolioTester.main(PortfolioTester.java:14) Caused by: java.lang.ClassNotFoundException: org.mockito.Mockito at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 2 more
I don't know what went wrong here. Can someone help me ?
The scope test indicates that the dependencies (binary files) are only used using maven's test phase. They are not delivered with the final target jar though. So if you run tests yourself (rather than letting maven do it), you'd better leave the default runtime scope, as follows:
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>2.0.2-beta</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With