What is the difference between mockito-core and mockito-all
mockito-core
only contains mockito classes, while mockito-all
contain mockito classes as well as some dependencies, one of them being hamcrest.
In fact mockito-all
is discontinued according to the mockito website
“mockito-all” distribution has been discontinued in Mockito 2.*.
The two packages were/are equivalent but if you depend on mockito-core
you'll need to add a specific dependency on the packages transitively included in mockito-all
if you require them in your project.
I've personally experienced some issues when depending on a newer version some hamcrest
matchers while at the same time having a dependency on mockito-all
.
Recently, I had JUnit tests can't use the right matcher to match the method as we using hamcrest 1.3, the mockito-all includes the classes from hamcrest of version 1.1, as well as objenesis of 1.0. Changing to use mockito-core, then add objenesis 1.0 as dependency, with already included dependency for hamcrest 1.3 resolves the issue completely.