Most popular mocking framework for Java
Current version is 2.x
Still on Mockito 1.x? See what’s new in Mockito 2!
Want to contribute? Take a look at the Contributing Guide.
- Search / Ask question on stackoverflow
- Go to the mockito mailing-list (moderated)
- Open a ticket in GitHub issue tracker
How to develop Mockito?
To build locally:
To develop in IntelliJ IDEA you can use built-in Gradle import wizard in IDEA. Alternatively generate the importable IDEA metadata files using:
Then, open the generated *.ipr file in IDEA.
How to release new version?
Mockito implements Continuous Delivery model. Every change on main branch (for example merging a pull request) triggers Travis CI release build. The build publishes new version if criteria are met: all tests green, no ‘ci skip release’ used in commit message, see the build log for more. New version is published to “mockito/maven” Bintray repository. Notable versions are automatically included in JCenter and Maven Central.
- Q: What’s new in Mockito release model? What are notable versions? A: In April 2017 we implemented Mockito Continuous Delivery Pipeline 2.0.
- Q: How to publish new notable version? A: Update “version.properties” file and set the next minor/major version like: “2.8.0”, “2.9.0”, “3.0.0”.
- Q: How to promote already released version to a notable version? A: There is no easy way at the moment. What’s the use case?
- Q: How to publish new notable version that is not a new minor/major (e.g. “2.8.34”)? A: There is no easy way at the moment but we’re planning to add this. Want to contribute?