There are two types of mockito, the mockito-core library and the mockito-all distribution. Basically it is better to use the latest version of mockito-core, but I will explain the difference.
mockito-core mockito-core is the main body of mockito. If you are using a package management tool such as maven or gradle, you can use mockito by including mockito-core in its dependency.
for maven
pom.xml
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.6.0</version>
<scope>test</scope>
</dependency>
For gradle
build.gradle
testCompile group: 'org.mockito', name: 'mockito-core', version: '3.6.0'
mockito-all mockito depends on hamcrest and objenesis. mockito-all includes mockito and its dependencies.
Use this for legacy projects where you manage dependencies manually. However, mockito-all has been deprecated since version 2.X and is only up to version 1.X.
Official site https://site.mockito.org/ "How do I drink it?" Explains how to use mockito.
The Difference Between mockito-core and mockito-all https://www.baeldung.com/mockito-core-vs-mockito-all
Recommended Posts