问题
As a part of unit test I need to mock a void function(Which accept any non-primitive paramter. e.g. MAP) call with any argument.
mockObj.myMethod(<anyObject>)
Is it possible to do this with EasyMock?
回答1:
Use either of the anyObject
methods: anyObject() or anyObject(T)
So
expect(mockObj.myMethod(anyObject()));
See the Flexible Expectations with Argument Matchers section of the documentation
来源:https://stackoverflow.com/questions/17123993/how-to-expect-void-method-call-with-any-argument-using-easymock