Loading…
57+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes what is mocking, mockito setup, when thenreturn, verify, and more.
Suggested path
Topics follow a teaching order. Each answer ends with a clear Next question control so you can move forward without hunting the list.
Mockito (fresher level) introduces mocking for unit tests. This module is an elevation arc: it opens with what mocking is (the motivation — isolating the unit under test), then Mockito setup and the when/thenReturn stubbing pattern. Verify (the interaction assertion) and argument matchers follow at the mechanics tier, then mock vs stub vs spy (the test-double taxonomy). InjectMocks and testing Spring services close the module at the applied tier.
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–57 globally so you always know where you are. Collapse topics if you want a lighter view — use Expand all when you need the full list again.
Numbers 1–57 follow the order we recommend — click any row to open the full answer, or use the sticky Next link at the bottom of each page to go Q1 → Q57.