kaofelix / todo-list-tdd-mockito

An example of using TDD with Mockito to build a command line todo list.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An Intro to TDD with Mockito

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.

About

An example of using TDD with Mockito to build a command line todo list.


Languages

Language:Java 100.0%