Open infinite opened 9 years ago
From loomis on 2011-06-14 09:45:32+00:00
You can do it by calling:
verify().that(myObject.myProperty = 5);
or
verify().that(myObject.myProperty = any());
In future, please direct question to the mailing list, that way more people will be able to give you answers.
From Anonymous on 2011-06-14 11:53:06+00:00
Thank you. Yes, next time I will mail the mailing list.
It's just nice to have the responses here on the website so we can look up the answers and direct people to the webpage.
I am defining a test like this:
myObject = mock( MyClass , "myObject" , [] ); given( myObject.myProperty ).willReturn( 5 ); otherObject.testFunction(); verify().that( myObject.myProperty );
I am defining the value returned for the getter of myProperty using "given", and trying to check later that the myProperty setter was called in the "verify" statement.
The test fails, saying that the getter for myProperty is not being called. Is there a way to specify that I want to verify the setter, not the getter, getting called?
Thanks,