I have a class A
that needs to be tested. The following is the definition of A
:
public class A {
private Human human = new Human();
private SuperService service;
public void methodOne() {
service.processFile(human);
}
}
In my test I want to do something like this:
verify(service, times(1)).processFile(new Human());
Of course, I get a failure because of:
Argument(s) are different! Wanted:
Human$1@60cf80e7
Actual invocation has different arguments:
Human@302fec27
What I need is to set the human
attribute to some specific value while it is being tested. Is there a way I can do this using mockito?