Using easymock, repeated void method call

Hendrik picture Hendrik · Aug 3, 2009 · Viewed 18.7k times · Source

I am new to easymock.

I am trying to mock a service where one of the methods is a void method that will get called an unknown (and large) number of times. How do I specify that any number of calls is allowed?

I know how to do it for methods that have a non-void return type.

Thanks

Answer

Arne Burmeister picture Arne Burmeister · Aug 3, 2009

Call the void method of the mock. Afterwards use EasyMock.expectLastCall().anyTimes()