Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is Mockito like Junit?

 
Rogerio Kioshi
Ranch Hand
Posts: 690
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to know if Mockito does the same thing JUnit does.
 
Tomek Kaczanowski
author
Ranch Hand
Posts: 40
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 http://junit.org and http://mockito.org for more information.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic