"매 mock = 매 collaborator 의 stub + verify". Java testing 의 매 de facto mocking framework. JUnit 5 + Mockito 5.x 의 매 standard combo. 2026 modern Java (21 LTS / 25) 매 record + sealed type 와 호환.
매 핵심
매 capability
Stub: 매 method 의 fake return value.
Verify: 매 interaction 의 assertion (called N times, with args).
Spy: 매 real object 의 partial mock.
Argument captor: 매 invocation arg 의 capture, inspect.
언제: 매 stub setup boilerplate 의 generate, verify assertion 의 propose, captor pattern 의 explain.
언제 X: 매 test design, what to mock vs integration-test — design judgment.
❌ 안티패턴
Mock everything: 매 value object 의 mock = brittle test.
Over-verify: 매 internal call 의 verify = refactor 의 break.
Mock 의 your own mock: cascade mock = smell. Refactor SUT.
No MockitoExtension: stub 의 strict mode 의 lose.
🧪 검증 / 중복
Verified (Mockito official docs, Effective Unit Testing by Koskela, Mockito 5.x release notes).
신뢰도 A.
🕓 Changelog
날짜
변경
2026-05-08
Phase 1
2026-05-10
Manual cleanup — Mockito 5 + JUnit 5 patterns for modern Java