vendredi 3 juin 2016

ignore argument value passed in function under test doesn't work

I am using OCMock 3 to do unit testing in my iOS project.

I simply want to verify that a function is invoked without concerning what is the argument value passed in.

For example, I want to verify the following function is invoked:

[school startTime:currentTime];

(Short note: the funcition in School class -(void)startTime:(long long) takes a long long type parameter)

In my test case I tried:

OCMVerify([schoolMock startTime:(long long)[OCMArg any]]);

I am pretty sure the code under test has been invoked, but I get error: OCMockObject(School):Method startTime:2005634354 was not invoked.

It looks like OCMock is still verifying the exact value of argument passed into the function. WHY?

Aucun commentaire:

Enregistrer un commentaire