vendredi 29 mai 2015

Easymock expectLastCall

I am using Easymock with junit for writing my unit tests. I have a doubt in this regard and I could not find a very lucid explanation regarding it.
How do you test void methods ?
Since they do not return anything, so something like :

Easymock.expect(myMockObject.func(easymock.isa(String.class))).andReturn("NOTHING TO RETURN HERE");

above would not work as I have nothing to return.
So, how do I set my expectation and how to test a void method ?
I came to know that something like easymock.expectLastCall() would fit in but I am not sure as to what it does and why do we need it. A lucid explanation would be highly appreciated.

Aucun commentaire:

Enregistrer un commentaire