Here is pretty simple “bug scenario”: I have a perfectly working and covered with tests MYPerson
class (with overwritten ‘isEqual’ and ‘hash’ methods). Then I decide to add a new property job
of MYJob
class, and forget to modify isEqual:
and hash
methods. The result is both these methods return YES
when two MYPerson
instances have different job
s. Looks like the perfect bug to be caught by unit tests, but I have trouble writing such a test because of OCMock
limitations - apparently both isEqual
and hash
methods can not be stubbed. And if I use actual MYJob
objects in my tests I would be testing MYJob
instead of MYPerson
implementation, right?
Does anyone have a good solution or thoughts on this?
Aucun commentaire:
Enregistrer un commentaire