Mockito
Metrics as of , from the GitHub or GitLab API of each repository. Refreshed monthly.
What Mockito is
Mockito is a mocking framework for unit tests in Java. Mocks are created with mock() or the @Mock annotation. Stubbing with when() or given() defines how mocked methods respond. Verification checks that methods were called with specific arguments. Partial mocks come from spy() or @Spy. The @InjectMocks annotation injects mocks and spies automatically. Argument matchers such as any() and argument capture through @Captor are also documented. Mockito 5 requires Java 11 and uses mockito-inline as the default mockmaker. Only one major version receives support at a time.
Written from the project's README, read , and its documentation (see sources).
- Category
- Test data and mocking
- License
- MIT
- Language
- Java
- Changelog
- Releases on GitHub
Repository metrics
Status
activeLast commit within 90 days of the fetch date.Computed from the last commit date and the archive flag on the fetch date. See the status rules.
Alternatives
Listed test data and mocking tools, same primary language first, then by GitHub stars. Each line gives one fact from the tool's documentation where it differs from Mockito's, with its source.
Karate: Languages for writing tests: Karate DSL with Gherkin-based syntax. source: Docs: Why Karate?
Testcontainers for Java: Definition format: Code (Java; containers declared as GenericContainer fields with the @Container annotation). source: Docs: JUnit 5 Quickstart
WireMock: Languages for writing tests: Java and JVM; community solutions for Python, Node.js, .NET, Go, Rust, Kotlin, Groovy and others. source: Docs: WireMock Java
MockServer: Languages for writing tests: Clients for Java, JavaScript/Node, Python, Ruby, Go, PHP, .NET and Rust. source: README
Microcks: Languages for writing tests: Java, NodeJS/TypeScript, Go and .NET through Testcontainers modules. source: Docs: Testcontainers Modules
Datafaker: Languages for writing tests: Java and Kotlin. source: Docs: Getting started
JSON Server: Definition format: JSON or JSON5 data file (db.json or db.json5). source: README
Faker: Languages for writing tests: Python (3.8 and above). source: README
Comparisons
Questions
Is Mockito open source?
Yes. Mockito is released under MIT, an OSI-approved license, as reported by the GitHub API on 2026-09-22.
Is Mockito maintained?
On 2026-09-22, the last commit to the default branch was on 2026-09-09, so the listed status is active. Rule: Last commit within 90 days of the fetch date.
How many GitHub stars does Mockito have?
15,457 stars on 2026-09-22, from the GitHub API. The number is refreshed at each monthly update.
What language is Mockito written in?
The repository's primary language, as reported by the GitHub API, is Java.
Sources
- GitHub REST API: repository, read
- GitHub REST API: commits, read
- GitHub REST API: latest release, read
- GitHub REST API: contributors, read
- README, read
- Mockito site, read