Module 17: Professional Development Practices
Mocking with Mockito
Isolate units by mocking collaborators and verifying interactions.
Extend tests with MockitoExtension to enable annotations like @Mock and @InjectMocks.
Stub behaviors using when(...).thenReturn(...) or thenThrow(...) and verify interactions with verify(...).
Avoid over-mocking; rely on integration tests for cross-component behavior.