0

How can I use Easymock.verify(mockedObject); to check only a specific expected method call on that mocked object instead of checking all the expected methods.

In another words how can I verify the call of specific method rather than all of them.

Thanks.

4

1 回答 1

1

Explicitly set the number of calls expected of the methods that you do not want to check to .anyTimes()

expect(mymock.unwantedMethod()).andReturn("something).anyTimes()

or make it a stub implementation:

expect(mymock.unwantedMethod()).andStubReturn("something)

This way only the expected method call will be validated.

于 2012-07-31T03:02:31.430 回答