This repo has the code for a lightning talk I made at the Jozi JUG meetup on 25 March 2013. The purpose was to show how I normally use Mockito to support TDD. The application is not at all complete, but has examples of the main Mockito features I use:
Creating a Mockito mock object obj
of the class Class
:
Class obj = mock(Class.class);
Stub obj.method
to return stubbedResponse
:
given(obj.method(argsOrMatchers)).willReturn(stubbedResponse);
Check if obj.method
was called:
verify(obj).method(argsOrMatchers)
Refer to the Mockito documentation for more features.