| S.No |
Topic |
Sub-Topics |
1 |
Introduction to Mockito |
What is Mockito?, Features, Benefits, Use cases, Unit testing overview |
| 2 |
Mockito Architecture |
Mocking framework, Core concepts, Stubbing, Verification, Interaction testing |
| 3 |
Setting up Mockito |
Maven dependency, Gradle dependency, IDE setup, JUnit integration, Project configuration |
| 4 |
Annotations in Mockito |
@Mock, @InjectMocks, @Spy, @Captor, @RunWith(MockitoJUnitRunner.class) |
| 5 |
Creating Mocks |
mock() method, @Mock annotation, Spy, Difference between mock and spy, Mocking interfaces |
| 6 |
Stubbing Methods |
when-thenReturn, thenThrow, thenAnswer, doReturn, doThrow |
| 7 |
Verifying Interactions |
verify(), times(), never(), atLeastOnce(), atMost() |
| 8 |
Argument Matchers |
any(), eq(), anyString(), anyInt(), custom matchers |
| 9 |
Spy vs Mock |
Partial mocking, Real method call, Difference, Use cases, Limitations |
| 10 |
Capturing Arguments |
ArgumentCaptor, capture(), verify, getValue(), getAllValues() |
| 11 |
BDD Style Testing |
given(), when(), then(), BDDMockito, Benefits, Examples |
| 12 |
Mocking Void Methods |
doNothing(), doThrow(), doAnswer(), verify, Handling exceptions |
| 13 |
Mocking Static Methods |
Mockito.mockStatic(), try-with-resources, when-then, Use cases, Best practices |
| 14 |
Mocking Final Classes & Methods |
Mockito-inline, Limitations, Stubbing final methods, Use cases, Configuration |
| 15 |
Mocking Private Methods |
Partial mocking, Spy, Reflection, PowerMockito, Use cases |
| 16 |
Consecutive Calls Stubbing |
thenReturn multiple values, thenThrow multiple exceptions, doAnswer, Chaining calls, Examples |
| 17 |
Timeouts & Verification |
verify with timeout, async testing, atLeast(), atMost(), Examples |
| 18 |
Resetting Mocks |
reset(), Clear invocations, When to reset, Best practices, Examples |
| 19 |
Mocking Collections |
List, Map, Set, Iteration, Stubbing methods |
| 20 |
Mocking Exceptions |
thenThrow, doThrow, Handling checked exceptions, Handling runtime exceptions, Use cases |
| 21 |
Verifying Order of Invocations |
InOrder, verify sequence, Multiple mocks, Examples, Best practices |
| 22 |
Timeout Verification |
verify with timeout, Asynchronous calls, Testing delays, Examples, Best practices |
| 23 |
Integration with JUnit |
JUnit 4, JUnit 5, Annotations, Running tests, Reporting |
| 24 |
Integration with TestNG |
TestNG setup, Annotations, Assertions, Running tests, Reporting |
| 25 |
Best Practices in Mockito |
Reusable mocks, Clear naming, Avoid over-mocking, Use annotations, Maintain readability |
| 26 |
Mockito & Spring Boot |
@MockBean, @SpyBean, Application context, Integration tests, Unit tests |
| 27 |
Behavior-Driven Testing |
given-when-then, BDDMockito, Readable tests, Real-life scenarios, Best practices |
| 28 |
Advanced Stubbing Techniques |
doAnswer, doReturn, doThrow, Chained stubbing, Conditional stubbing |
| 29 |
Hands-on Projects |
Mocking service layer, Repository mocking, API testing, Integration with JUnit, Reporting |
| 30 |
Certification & Career Path |
Mockito certification, Learning resources, Portfolio projects, Advanced testing skills, Career opportunities |