spring-boot-mockito

Installation
SKILL.md

Test Doubles with Mockito and Spring Test Overrides

Own the decision of what to fake in a test and the mechanics of doing it. A double is legitimate only at a boundary the test cannot reach cheaply; used as a default it deletes the behavior the test was written to prove.

When to use

  • Migrating @MockBean and @SpyBean to @MockitoBean and @MockitoSpyBean.
  • Deciding whether a dependency should be a mock, a hand-written fake, or the real implementation.
  • Stubbing return values, throwing, capturing arguments, or verifying interactions.
  • Handling a spy, a final class, a static factory, or a private constructor.
  • Fighting UnnecessaryStubbingException, PotentialStubbingProblem, or over-strict verification.
  • Reducing a test that mocks the persistence layer or the type under test.

When not to use

Installs
1
First Seen
Oct 25, 2026
Security Audits