Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between mockito-core and mockito-all

Tags:

difference between mockito-core and mockito-all? What would I not be able to do if I use only mockito-core for example?

like image 593
Manu Chadha Avatar asked Mar 09 '19 11:03

Manu Chadha


People also ask

Does Mockito-all include Mockito-core?

mockito-core only contains mockito classes, while mockito-all contain mockito classes as well as some dependencies, one of them being hamcrest. “mockito-all” distribution has been discontinued in Mockito 2.

Is Mockito inline part of Mockito-core?

0 it looks like mockito community has come up with mockito-inline for some experimental features like mocking final classes and methods, mocking static methods etc. So once they get feedback from community they will merge those changes in mockito-core and abolished mockito-inline.

What is the latest version of Mockito?

Current version is 4. Mockito 3 does not introduce any breaking API changes, but now requires Java 8 over Java 6 for Mockito 2.

What is the dependency for Mockito?

Of course, mockito-core has some dependencies like hamcrest and objenesis that Maven downloads separately, but mockito-all is an out-dated dependency that bundles Mockito as well as its required dependencies. The latest GA version of mockito-all is a 1.


1 Answers

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.

like image 69
Misantorp Avatar answered Oct 25 '22 10:10

Misantorp