Reputation: 1960
I am using jMock and I am confused as to how to mock an argument that I want to be any entityClass?
Here is the method I am trying to match:
public <T> List<T> find(Query query, Class<T> entityClass) { }
Here is what I got. I want to match anything on the second parameter:
allowing(template).find(with(any(Query.class)), Foo.class);
which doesn't work since I used with on the first parameter. I basically want to mock this method no matter what arguments are present.
Upvotes: 1
Views: 1100
Reputation: 2771
If you only want to ignore that one method in your mock object, you could also write:
allowing(template).find(with(any(Query.class)), with(any(Class.class)));
Upvotes: 1
Reputation: 1960
I switched to using the ignoring method to meet my needs:
ignoring(myTemplate);
Upvotes: 1