Hacker ApprovedDepartments

Mockito

The most recommended of 8 testing frameworks

People recommend it as a Java mocking library that works well for testing code that does not use dependency injection, and many call it good enough for most cases. Critics warn that it encourages brittle tests and lazy design.

People recommend it as a Java mocking library that works well for testing code that does not use dependency injection, and many call it good enough for most cases. Critics warn that it encourages brittle tests and lazy design.

32 people gave an opinion

recommend it
19
criticize it
13
approval share
59%
Each figure is one person. RecommendsCriticizes

Recommended in 3 of 13 months

  1. November 2025: not recommended
  2. December 2025: recommended
  3. January 2026: not recommended
  4. February 2026: not recommended
  5. March 2026: recommended
  6. April 2026: not recommended
  7. May 2026: not recommended
  8. June 2026: not recommended
  9. July 2026: not recommended
  10. August 2026: not recommended
  11. September 2026: recommended
  12. October 2026: not recommended
  13. November 2026: not recommended (month in progress)

Owned for 4 years

Median of the 4 owners who said how long they have had it.

Each square is one year.

Why it doesn’t carry the badge

  • 19 people recommend itNeeds 10 or more, met.
  • 1.4 recommenders for every criticNeeds 2 to 1 or better, not met.
  • Recommended in 3 of 13 monthsNeeds 4 or more, not met.

The same three rules apply to every product, and the badge can’t be bought. How the badge works

What people say about it

The reasons people give, with the number of comments that give each one. Open a reason to read what they said.

Why people recommend it

Each mark is one comment

  • Works for code without dependency injection

    “Mockito has decent facilities for working with those, especially when you're working with a codebase that isn't pure DI and interfaces.”

    Comment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

    “Mockito allows one to write mocks in tests for code that doesn't use dependency injection”

    Comment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

    “Mockito, in every case I had to use it, was a last resort because a third party library didnt lend itself to mocking”

    Comment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”
  • Good enough for most testing cases

    “I've been using Mockito for about 4 years, all in Kotlin. I always found it to be "plenty good" for like 99% of the cases I needed it”

    Comment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

    “"plenty good" for like 99% of the cases I needed it”

    Comment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

    “I like Mockito, it's useful”

    Comment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”
  • Useful when third-party libraries resist mocking

    “Mockito, in every case I had to use it, was a last resort because a third party library didnt lend itself to mocking”

    Comment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

    “The only way I was able to pull that off was using mocking”

    Comment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

What people warn about

Each mark is one comment

  • Encourages bad habits and brittle tests

    “Mocking encourages bad habits and a false sense of security.”

    Comment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

    “tests depending on mocking are far more brittle”

    Comment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

    “Mockito swoops in and prevents you from having that epiphany, by making it easier to keep doing things the stupid way.”

    Comment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”
  • Overused for pointless unit tests

    “Usually it is used for pointless unit tests of simple intermediary layers to test if call is delegated correctly”

    Comment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

    “It allows you to mock the whole universe so it becomes a hammer instead of nicely designed functions, interfaces.”

    Comment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

Other testing frameworks people recommend

The four most recommended other testing frameworks, with the same counts for each, so you can compare like for like. The tick on each bar marks the 2 to 1 line the badge needs.

Mockito compared with 4 alternatives
ProductRecommendCriticizeApprovalMonthsOwnedBadge
MockitoThis page191359%34 yrs4 owners—
cargo-nextest18195%3——
Vitest17868%8—Approved
Testcontainers14382%8—Approved
pytest12571%9—Approved
See all 8 testing frameworks, ranked

What people said

33 of the 35 comments that mention it, newest first. Each links to the original comment.

“Mockito (I bet it's the most common user of that feature)”

MixedComment from 16 Sep 2026 in “Java 27”

“You wanted Mockito to lead reality, but it lags it.”

CriticizesComment from 11 Aug 2026 in “Choral: Choreographic Programming for Java”

“Spring Boot also often brings friends like MapStruct or Lombok or Mockito which add even more dynamic behavior and issues when you update JDK”

CriticizesComment from 17 Mar 2026 in “Java 26 is here, and with it a solid foundation for the future”

“Do you use Mockito or one of the myriad alternatives?”

MixedComment from 3 Mar 2026 in “Go is the best language for agents”

“Usually it is used for pointless unit tests of simple intermediary layers to test if call is delegated correctly”

CriticizesComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“I also often find the mocking DSL the better choice in tests.”

MixedComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Sounds like a problem that the Mockito team created for themselves, and like a problem only they can solve.”

CriticizesComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“I spent some time replacing usages of it in Kafka test code with Mockito”

RecommendsComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“It allows you to mock the whole universe so it becomes a hammer instead of nicely designed functions, interfaces.”

CriticizesComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“avoided Mockito like GP, though it was occasionally useful”

MixedComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“But I'm talking about people write new code this way”

CriticizesComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“I like Mockito, it's useful”

RecommendsComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“I've been using Mockito for about 4 years, all in Kotlin. I always found it to be "plenty good" for like 99% of the cases I needed it”

MixedComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Mockito did help me a lot through those times”

RecommendsComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“The only way I was able to pull that off was using mocking”

RecommendsComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Mockito, in every case I had to use it, was a last resort because a third party library didnt lend itself to mocking”

MixedComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Mockito swoops in and prevents you from having that epiphany, by making it easier to keep doing things the stupid way.”

CriticizesComment from 29 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“tests depending on mocking are far more brittle”

CriticizesComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Mock is effective when developers keep applications at 4-5 layers deep”

RecommendsComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Mocking encourages bad habits and a false sense of security.”

CriticizesComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Spy's on the other hand, are a pain in the neck.”

MixedComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“IMO Mockito is fine, the problem I’ve encountered is people taking the easy way out”

RecommendsComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“So Mockito and friends are a nice alternative to that.”

RecommendsComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“To create interfaces just for testing complicates the code and it is one of my pet peeves.”

RecommendsComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“"plenty good" for like 99% of the cases I needed it”

RecommendsComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“They also encourage/enable code that is less testable.”

CriticizesComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“too many times have I really wanted mockito to also default to returning a mock instead of null”

CriticizesComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“1000 line test setups that shatter into pieces the instant you try to make the simplest change to a function”

CriticizesComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Mockito was indeed a poor fit for Kotlin.”

CriticizesComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Mockito does one thing well as a name, and that is hinting strongly at what it is (a mocking library).”

RecommendsComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Mockito has decent facilities for working with those, especially when you're working with a codebase that isn't pure DI and interfaces.”

RecommendsComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“Mockito allows one to write mocks in tests for code that doesn't use dependency injection”

RecommendsComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

“It’s taken years off of my life dealing with the test mess people have made with it.”

CriticizesComment from 28 Dec 2025 in “Stepping down as Mockito maintainer after 10 years”

Counts come from 1,795,640 Hacker News comments, November 2025 to November 2026. How we count. Report a mistake.