Skip to main content

Mockito

Learn Mockito (Spring MVC Testing, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Mockito creates fake objects (mocks) so you can test a class without its real collaborators. Core calls : mock(Type.class) or @Mock , when(...).thenReturn(...) to stub and verify(...) to check interactions. Default : an unstubbed mock method returns null, 0, false or an empty collection.

More lessons in Spring MVC Testing