Mockito is a mocking framework that can be downloaded from http://code.google.com/p/mockito/
An article about mockito:
http://gojko.net/2009/10/23/mockito-in-six-easy-examples/
quote from that article
To create a stub (or a mock), use mock(class). Then use when(mock).thenReturn(value) to specify the stub value for a method. If you specify more than one value, they will be returned in sequence until the last one is used, after which point the last specified value gets returned. (So to have a method return the same value always, just specify it once).
Code samples on that blog are adequate, so i will not reinvent the wheel with more examples..
Hiç yorum yok:
Yorum Gönder