mockito/mockito

Most popular Mocking framework for unit tests written in Java

6
Hotness score
56
Reliability score
15,445
Stars
almost 14 years
Age
0
Published reviews
0
Questions

Scores

Hotness and reliability

The two headline scores, measured daily, with 30, 90, and 180 day views.

Hotness score

Jul 19, 2026

Current6

Previous10

Weekly average

100500
Full metrics details

Derived only from GitHub GraphQL starredAt events after daily star totals are reconciled.

180 observed daily rows. Missing days are not fabricated.

Hotness formula

40% Hot today + 40% Hot this week + 20% Breakout.

  • 40% Hot today: 7
  • 40% Hot this week: 12
  • 20% Breakout: 1
  • Stars gained: 1d: 1
  • Stars gained: 7d: 3
  • Stars gained: 14d: 7
  • Stars gained: 30d: 20
  • Stars gained: 90d: 70

Per-day formula: 0.40 × Hot today + 0.40 × Hot week + 0.20 × Breakout.

  • Same-day multiplier = stars 1d ÷ max(1, stars 7d ÷ 7)
  • Weekly multiplier = stars 7d ÷ max(1, stars 30d ÷ 30 × 7)
  • Fortnight multiplier = stars 14d ÷ max(1, stars 90d ÷ 90 × 14)
  • Hot today = clamp(70 × log-scale(stars 1d, 1000) + 30 × breakout-scale(same-day, 4))
  • Hot week = clamp(75 × log-scale(stars 7d, 5000) + 25 × breakout-scale(weekly, 3))
  • Breakout = clamp(35 × breakout-scale(same-day, 4) + 40 × breakout-scale(weekly, 3) + 25 × breakout-scale(fortnight, 2.5))
DateStarsStars 1dStars 7dStars 14dStars 30dStars 90dSame-day multiplierWeekly multiplierFortnight multiplierHot todayHot weekBreakoutStored score

Reliability score

Jul 19, 2026

Current56

Previous53

Weekly average

100500
Full metrics details

Derived from the displayed continuity, closure, shipping, liveness, and support-burden components.

180 observed daily rows. Missing days are not fabricated.

Reliability formula

30% Continuity + 30% Closure + 20% Shipping + 10% Liveness + 10% Support burden.

  • 30% Continuity: 54
  • 30% Closure: 79
  • 20% Shipping: 8
  • 10% Liveness: 97
  • 10% Support burden: 42

Per-day formula: 0.30 × Continuity + 0.30 × Closure + 0.20 × Shipping + 0.10 × Liveness + 0.10 × Support burden.

  • Continuity = 35% active ratio 90d + 20% active ratio 30d + 15% PR efficiency 90d + 10% PR efficiency 30d + 10% liveness + 10% observed-history coverage
  • Closure = 55% PR merge efficiency 90d + 45% issue close efficiency 90d
  • Shipping = 100 × (20% × release ratio 30d + 30% × release ratio 90d + 50% × release ratio 180d); ratios are releases ÷ 2, 6, and 12, capped at 1
  • Support burden = 100 − 2 × open issues per 1,000 stars
  • Liveness = 100 × exp(−pushed days ago ÷ 120)

Stars, issues, pull requests, and releases are daily observations. Pushed-days and license are repository snapshot-derived inputs and are not independent historical GitHub events.

DateIssues openedIssues closedPRs openedPRs mergedReleasesStarsOpen issuesPushed days agoContinuityClosureShippingLivenessSupport burdenLicenseObserved daysMissing daysNeeds healingStored score

Reliability breakdown

What drives the reliability score

Component scores measured daily from GitHub activity (2026-07-19).

Continuity30% of headline54

Activity on 32 of 90 tracked days in the last 90 and 13 of 30 in the last 30.

Closure30% of headline79

Merged 16 of 25 PRs opened and closed 8 of 8 issues opened over the last 90 tracked days — PR flow carries 55% of this component, issue flow 45%.

Shipping20% of headline8

2 releases in the last 180 days, 0 in the last 90 and 0 in the last 30 — a steady cadence scores highest.

Liveness10% of headline97

Last push 5 days ago — freshness decays as pushes age (roughly halves every 83 days without a push).

Support burden10% of headline42

450 open issues against 15,445 stars — about 29 open issues per 1,000 stars. Lighter backlogs score higher.

Adoption confidence73

Modeled — how confidently teams are adopting this repo. Stargazers

Maintenance quality55

Modeled from PR/issue responsiveness and upkeep signals. Activity pulse

Risk score35

Modeled — lower is better; adoption and continuity risk. Repository

Stays active (30d)63%

Modeled chance the repo stays active over 30 days. Activity pulse

Stays active (90d)62%

Modeled chance the repo stays active over 90 days. Activity pulse

Release rhythm (180d)8

Regularity of releases over the last 180 days. Releases

Maintainer bus risk (90d)46%

Modeled — lower is better; concentration of commits in few maintainers. Contributors graph

Topics

Explore related topics

Jump into the topic listings this repository belongs to.

Measured history

Project metrics

Weekly GitHub totals with 30, 90, and 180 day views.

Weekly star gains

Jul 19, 2026

Current2

Previous5

Weekly star gains

1260
Full metrics details

GitHub GraphQL current stargazer cohort, reconstructed from starredAt events and totalCount retrieved in one stable pagination walk. GitHub does not expose historical unstar events, so this is not an exact ledger of past star counts.

180 observed daily rows. Missing days are not fabricated.

DateValue

Cumulative stars

Jul 19, 2026

Current15,444

Previous15,442

Cumulative total

15,4447,7220
Full metrics details

Running total of the GitHub GraphQL stargazer count over time (not weekly deltas), reconstructed from starredAt events and totalCount in one stable pagination walk. GitHub does not expose historical unstar events, so this is not an exact ledger of past star counts.

180 observed daily rows. Missing days are not fabricated.

DateValue

Issues opened

Jul 19, 2026

Current0

Previous0

Weekly total

210
Full metrics details

GitHub API observation. Historical values render only when the source provides a real observation for that day.

179 observed daily rows. Missing days are not fabricated.

DateValue

Issues closed

Jul 19, 2026

Current1

Previous0

Weekly total

210
Full metrics details

GitHub Search issue totals queried for exact UTC days; rolling values are sums of proven daily counts.

179 observed daily rows. Missing days are not fabricated.

DateValue

Pull requests opened

Jul 19, 2026

Current2

Previous5

Weekly total

530
Full metrics details

GitHub API observation. Historical values render only when the source provides a real observation for that day.

179 observed daily rows. Missing days are not fabricated.

DateValue

Pull requests closed

Jul 19, 2026

Current3

Previous2

Weekly total

420
Full metrics details

GitHub Search pull-request totals queried for exact UTC days; rolling values are sums of proven daily counts.

179 observed daily rows. Missing days are not fabricated.

DateValue

Pull requests merged

Jul 19, 2026

Current2

Previous2

Weekly total

320
Full metrics details

GitHub API observation. Historical values render only when the source provides a real observation for that day.

179 observed daily rows. Missing days are not fabricated.

DateValue

Issue close ratio (daily)

Jun 23, 2026

Current0.00

Previous1.00

Daily ratio — a gap means nothing was opened that day

How this works: each day's value is issues closed that day ÷ issues opened that day. Days when nothing was opened render as gaps — never a rolling average or a made-up zero. Values above 1 mean the project closed more issues than arrived that day.

1.000.500.00
Full metrics details

GitHub Search issue totals queried for exact UTC days; rolling values are sums of proven daily counts.

13 observed daily rows. Missing days are not fabricated.

Per-day formula: issues closed that day ÷ issues opened that day; blank when nothing was opened (a gap, not a zero).

DateIssues openedIssues closedStored score

Pull request close ratio (daily)

Jul 15, 2026

Current1.00

Previous2.00

Daily ratio — a gap means nothing was opened that day

How this works: each day's value is pull requests closed that day ÷ pull requests opened that day. Days when nothing was opened render as gaps — never a rolling average or a made-up zero. Values above 1 mean the project closed more pull requests than arrived that day.

2.001.000.00
Full metrics details

GitHub Search pull-request totals queried for exact UTC days; rolling values are sums of proven daily counts.

39 observed daily rows. Missing days are not fabricated.

Per-day formula: pull requests closed that day ÷ pull requests opened that day; blank when nothing was opened (a gap, not a zero).

DatePRs openedPRs closedStored score

Releases

Jul 19, 2026

Current0

Previous0

Weekly total

110
Full metrics details

GitHub release published_at events bucketed by UTC day; drafts are excluded.

180 observed daily rows. Missing days are not fabricated.

DateValue

Project Overview

Mockito gives your team a Java mocking framework for isolating units under test when collaborators are expensive, stateful, or nondeterministic. You can replace real collaborators with test doubles, configure return behavior, and verify interaction contracts directly in tests.

From project docs, the current major line is 5.x, with Java 11 as the runtime baseline and inline mock maker defaults. Earlier major transitions removed deprecated APIs and raised minimum Java requirements. That version policy matters for your build matrix and branch maintenance strategy.

If your test strategy depends on clear behavior-driven verification and low-friction mock setup, Mockito fits naturally. You can keep test intent readable while reducing setup noise compared with hand-rolled fake objects in many cases.

Key Challenges Addressed

A common pain point in unit testing is hidden coupling to external systems or complex collaborators. Mockito addresses that by letting your team define collaborator behavior in the test and focus assertions on outcomes and interactions.

You also need failure messages and verification patterns that are understandable during refactoring. Mockito’s interaction verification model helps you encode collaborator contracts explicitly, so breaking changes surface quickly in tests rather than later in integration stages.

Another challenge is keeping test setup lightweight. Mockito lowers the cost of creating test doubles for interfaces and classes, which can reduce boilerplate and keep tests closer to domain behavior.

Getting Started

You can start by adding org.mockito:mockito-core from Maven Central and running tests in your existing JUnit setup. If your team uses modern Java baselines, align on Mockito 5.x and confirm Java 11+ in CI before rollout.

For a first useful workflow, mock a repository or gateway dependency, stub one successful path and one error path, then verify method interaction counts. Your immediate sharp edge is over-specifying interactions; keep verifications focused on behavior that matters to contract stability.

Features and Use Cases

Mockito supports core unit testing patterns: creating mocks, stubbing method responses, verifying calls, and argument matching. You can apply those patterns in service-layer logic, adapter code, retry orchestration, and policy engines where side effects should be controlled.

In legacy code refactors, your team can use mocks to pin critical collaboration behavior before changing internals. In new code, you can shape seams around interfaces and keep test setup small enough to run quickly in local feedback loops.

With current major versions, your team should track release notes and semantic-versioning guidance so plugin/build alignment stays predictable across modules.

Ecosystem and Dependencies

Mockito fits directly into common JVM test stacks with JUnit. You normally consume it through Maven or Gradle dependency management and run it in standard test tasks. Javadocs and release notes are published in official channels for versioned reference.

Your team should keep these official resources handy: homepage, GitHub repository, release notes, and latest javadocs.

Because only one major version is actively supported at a time, dependency alignment across services is important to avoid mixed expectations in shared test utilities.

Architectural Overview

Mockito works as a runtime test utility that creates and manages mock proxies, records interactions, and evaluates verifications against recorded calls. Your test defines stubbing and verification rules; Mockito runtime infrastructure enforces those rules during execution.

The architecture encourages clear seams in your production code: constructor-injected dependencies, interface boundaries, and deterministic business methods are easier to test with mock-based strategies. When your team follows those design constraints, tests stay readable and robust.

For operability in CI, you want consistent Java baseline enforcement and explicit dependency versions. That keeps mock behavior stable and avoids subtle classpath surprises during framework upgrades.

Pros and Cons

Mockito gives your team a fast path to isolated unit tests with clear intent. Test code usually remains concise, and verification semantics are strong enough to catch collaborator contract regressions quickly.

The main downside is misuse risk: overly interaction-heavy tests can become brittle and tightly coupled to implementation details. Your team should avoid verifying every call and instead verify meaningful external behavior.

Version alignment is another practical concern because baseline Java requirements changed across major versions. If your repositories span older runtimes, migration planning is required before standardizing on newer Mockito lines.

Comparison and Alternatives

Measured 90-day trends for this project and its alternatives.

GitHub stars

Weekly star gains

1050
Full metrics details

GitHub GraphQL current stargazer cohort, reconstructed from starredAt events and totalCount retrieved in one stable pagination walk. GitHub does not expose historical unstar events, so this is not an exact ledger of past star counts.

Mockito

GitHub GraphQL current stargazer cohort, reconstructed from starredAt events and totalCount retrieved in one stable pagination walk. GitHub does not expose historical unstar events, so this is not an exact ledger of past star counts.

180 observed daily rows. Missing days are not fabricated.

DateValue
Easymock

GitHub GraphQL current stargazer cohort, reconstructed from starredAt events and totalCount retrieved in one stable pagination walk. GitHub does not expose historical unstar events, so this is not an exact ledger of past star counts.

78 observed daily rows. Missing days are not fabricated.

DateValue

Issues opened

Weekly total

210
Full metrics details

GitHub API observation. Historical values render only when the source provides a real observation for that day.

Mockito

GitHub API observation. Historical values render only when the source provides a real observation for that day.

179 observed daily rows. Missing days are not fabricated.

DateValue
Easymock

GitHub API observation. Historical values render only when the source provides a real observation for that day.

36 observed daily rows. Missing days are not fabricated.

DateValue

Issues closed

Weekly total

210
Full metrics details

GitHub Search issue totals queried for exact UTC days; rolling values are sums of proven daily counts.

Mockito

GitHub Search issue totals queried for exact UTC days; rolling values are sums of proven daily counts.

179 observed daily rows. Missing days are not fabricated.

DateValue
Easymock

GitHub Search issue totals queried for exact UTC days; rolling values are sums of proven daily counts.

36 observed daily rows. Missing days are not fabricated.

DateValue

Pull requests opened

Weekly total

530
Full metrics details

GitHub API observation. Historical values render only when the source provides a real observation for that day.

Mockito

GitHub API observation. Historical values render only when the source provides a real observation for that day.

179 observed daily rows. Missing days are not fabricated.

DateValue
Easymock

GitHub API observation. Historical values render only when the source provides a real observation for that day.

36 observed daily rows. Missing days are not fabricated.

DateValue

Pull requests closed

Weekly total

530
Full metrics details

GitHub Search pull-request totals queried for exact UTC days; rolling values are sums of proven daily counts.

Mockito

GitHub Search pull-request totals queried for exact UTC days; rolling values are sums of proven daily counts.

179 observed daily rows. Missing days are not fabricated.

DateValue
Easymock

GitHub Search pull-request totals queried for exact UTC days; rolling values are sums of proven daily counts.

36 observed daily rows. Missing days are not fabricated.

DateValue

Pull requests merged

Weekly total

320
Full metrics details

GitHub API observation. Historical values render only when the source provides a real observation for that day.

Mockito

GitHub API observation. Historical values render only when the source provides a real observation for that day.

179 observed daily rows. Missing days are not fabricated.

DateValue
Easymock

GitHub API observation. Historical values render only when the source provides a real observation for that day.

36 observed daily rows. Missing days are not fabricated.

DateValue

Open/closed pull request ratio

Weekly average

100500
Full metrics details

GitHub Search pull-request totals queried for exact UTC days; rolling values are sums of proven daily counts.

Mockito

GitHub Search pull-request totals queried for exact UTC days; rolling values are sums of proven daily counts.

180 observed daily rows. Missing days are not fabricated.

DateValue
Easymock

GitHub Search pull-request totals queried for exact UTC days; rolling values are sums of proven daily counts.

78 observed daily rows. Missing days are not fabricated.

DateValue

Open/closed issues ratio

Weekly average

100500
Full metrics details

GitHub Search issue totals queried for exact UTC days; rolling values are sums of proven daily counts.

Mockito

GitHub Search issue totals queried for exact UTC days; rolling values are sums of proven daily counts.

180 observed daily rows. Missing days are not fabricated.

DateValue
Easymock

GitHub Search issue totals queried for exact UTC days; rolling values are sums of proven daily counts.

78 observed daily rows. Missing days are not fabricated.

DateValue

Releases

Weekly total

110
Full metrics details

GitHub release published_at events bucketed by UTC day; drafts are excluded.

Mockito

GitHub release published_at events bucketed by UTC day; drafts are excluded.

180 observed daily rows. Missing days are not fabricated.

DateValue
Easymock

GitHub release published_at events bucketed by UTC day; drafts are excluded.

78 observed daily rows. Missing days are not fabricated.

DateValue

Hotness score

Weekly average

100500
Full metrics details

Derived only from GitHub GraphQL starredAt events after daily star totals are reconciled.

Mockito

Derived only from GitHub GraphQL starredAt events after daily star totals are reconciled.

180 observed daily rows. Missing days are not fabricated.

Per-day formula: 0.40 × Hot today + 0.40 × Hot week + 0.20 × Breakout.

  • Same-day multiplier = stars 1d ÷ max(1, stars 7d ÷ 7)
  • Weekly multiplier = stars 7d ÷ max(1, stars 30d ÷ 30 × 7)
  • Fortnight multiplier = stars 14d ÷ max(1, stars 90d ÷ 90 × 14)
  • Hot today = clamp(70 × log-scale(stars 1d, 1000) + 30 × breakout-scale(same-day, 4))
  • Hot week = clamp(75 × log-scale(stars 7d, 5000) + 25 × breakout-scale(weekly, 3))
  • Breakout = clamp(35 × breakout-scale(same-day, 4) + 40 × breakout-scale(weekly, 3) + 25 × breakout-scale(fortnight, 2.5))
DateStarsStars 1dStars 7dStars 14dStars 30dStars 90dSame-day multiplierWeekly multiplierFortnight multiplierHot todayHot weekBreakoutStored score
Easymock

Derived only from GitHub GraphQL starredAt events after daily star totals are reconciled.

78 observed daily rows. Missing days are not fabricated.

Per-day formula: 0.40 × Hot today + 0.40 × Hot week + 0.20 × Breakout.

  • Same-day multiplier = stars 1d ÷ max(1, stars 7d ÷ 7)
  • Weekly multiplier = stars 7d ÷ max(1, stars 30d ÷ 30 × 7)
  • Fortnight multiplier = stars 14d ÷ max(1, stars 90d ÷ 90 × 14)
  • Hot today = clamp(70 × log-scale(stars 1d, 1000) + 30 × breakout-scale(same-day, 4))
  • Hot week = clamp(75 × log-scale(stars 7d, 5000) + 25 × breakout-scale(weekly, 3))
  • Breakout = clamp(35 × breakout-scale(same-day, 4) + 40 × breakout-scale(weekly, 3) + 25 × breakout-scale(fortnight, 2.5))
DateStarsStars 1dStars 7dStars 14dStars 30dStars 90dSame-day multiplierWeekly multiplierFortnight multiplierHot todayHot weekBreakoutStored score

Reliability score

Weekly average

100500
Full metrics details

Derived from the displayed continuity, closure, shipping, liveness, and support-burden components.

Mockito

Derived from the displayed continuity, closure, shipping, liveness, and support-burden components.

180 observed daily rows. Missing days are not fabricated.

Per-day formula: 0.30 × Continuity + 0.30 × Closure + 0.20 × Shipping + 0.10 × Liveness + 0.10 × Support burden.

  • Continuity = 35% active ratio 90d + 20% active ratio 30d + 15% PR efficiency 90d + 10% PR efficiency 30d + 10% liveness + 10% observed-history coverage
  • Closure = 55% PR merge efficiency 90d + 45% issue close efficiency 90d
  • Shipping = 100 × (20% × release ratio 30d + 30% × release ratio 90d + 50% × release ratio 180d); ratios are releases ÷ 2, 6, and 12, capped at 1
  • Support burden = 100 − 2 × open issues per 1,000 stars
  • Liveness = 100 × exp(−pushed days ago ÷ 120)

Stars, issues, pull requests, and releases are daily observations. Pushed-days and license are repository snapshot-derived inputs and are not independent historical GitHub events.

DateIssues openedIssues closedPRs openedPRs mergedReleasesStarsOpen issuesPushed days agoContinuityClosureShippingLivenessSupport burdenLicenseObserved daysMissing daysNeeds healingStored score
Easymock

Derived from the displayed continuity, closure, shipping, liveness, and support-burden components.

78 observed daily rows. Missing days are not fabricated.

Per-day formula: 0.30 × Continuity + 0.30 × Closure + 0.20 × Shipping + 0.10 × Liveness + 0.10 × Support burden.

  • Continuity = 35% active ratio 90d + 20% active ratio 30d + 15% PR efficiency 90d + 10% PR efficiency 30d + 10% liveness + 10% observed-history coverage
  • Closure = 55% PR merge efficiency 90d + 45% issue close efficiency 90d
  • Shipping = 100 × (20% × release ratio 30d + 30% × release ratio 90d + 50% × release ratio 180d); ratios are releases ÷ 2, 6, and 12, capped at 1
  • Support burden = 100 − 2 × open issues per 1,000 stars
  • Liveness = 100 × exp(−pushed days ago ÷ 120)

Stars, issues, pull requests, and releases are daily observations. Pushed-days and license are repository snapshot-derived inputs and are not independent historical GitHub events.

DateIssues openedIssues closedPRs openedPRs mergedReleasesStarsOpen issuesPushed days agoContinuityClosureShippingLivenessSupport burdenLicenseObserved daysMissing daysNeeds healingStored score

You can compare Mockito with EasyMock, JMockit, and MockK. Mockito usually wins on mainstream Java workflow familiarity and broad documentation coverage, while alternatives may fit specialized preference around style or language focus.

Project Repo Adoption confidence (~6mo) PRs merged (~6mo) Star growth (~6mo)
EasyMock https://github.com/easymock/easymock ██████████ 52.60 ██████████ 91 ██████████ 11

Best overall alternative: EasyMock, because you get a long-standing Java mocking option with a clear API model and mature ecosystem familiarity.

Conclusion

You use Mockito when your team wants isolated Java unit tests with concise mock setup and explicit interaction verification. It is strongest when your codebase has clean dependency seams and you need fast feedback during refactoring.

Your key trade-off is test design discipline: avoid interaction over-specification, align Java baseline with framework major version, and keep dependency governance explicit. Keep the repository, homepage, and release notes in your internal test standards.

Join the conversation

Reviews · Questions · Posts

Share what you know about mockito — write a review from your real experience, ask an implementation question, or publish a post about how you use it.

Share your experience

Write or update your review

Explain what worked, what broke down, and what another team should know before adopting mockito.

Write your review now — it saves locally and publishes automatically after you sign in.

Rating
Positive attributes
Negative attributes

Project Q&A

Questions and answers

Browse implementation threads tied directly to mockito/mockito. Each question links through to the full answer page.

Q&A No threads yet

Be the first to ask how teams run mockito in production. Every question you post becomes a durable, searchable answer page other developers can find.

Ask the first question

Related posts

Posts tagged with the same topics

These posts come from the same topic surface as this repo, so readers can move from project evaluation into practical writeups and migration notes without leaving context.

Posts No topic-linked posts yet

Share how your team uses mockito — a migration note, an architecture writeup, or a comparison. Your post reaches everyone browsing these same topics.

Write the first post
Get a weekly email with the hottest new projects in the Unit Testing Frameworks and Tdd world.
No Spam. Unsubscribe easily at any time.

Copyright 2018-2026 Awesome Open Source.  All rights reserved.