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
@MockBeanand@SpyBeanto@MockitoBeanand@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.