aspose file tools*
The moose likes Testing and the fly likes Is Mockito like Junit? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Is Mockito like Junit?" Watch "Is Mockito like Junit?" New topic

Is Mockito like Junit?

Rogerio Kioshi
Ranch Hand

Joined: Apr 12, 2005
Posts: 689
I'd like to know if Mockito does the same thing JUnit does.

Tomek Kaczanowski
Ranch Hand

Joined: Oct 26, 2005
Posts: 40

Hi Rogerio,

the short answer is: no.

JUnit is a framework for writing and running tests (especially unit tests).
Mockito allows to create mocks (test doubles) which can replace real collaborators of a class, thus making it possible to implement some test cases.

JUnit and Mockito are often used together. JUnit is used to create the structure of test, while Mockito allow to specify some details of tests within the framework imposed by JUnit.

Please see and for more information.

Tomek Kaczanowski
Book author: Practical Unit Testing with TestNG and Mockito
I agree. Here's the link:
subject: Is Mockito like Junit?