First, be aware that when you don't specify a matcher to OCMockito, it uses the isEqual
matcher. This probably isn't what you want to verify for the second argument. I'd check for identity instead:
fromSearchManager:sameInstance(_sm)
If the argument is typed, it will complain that the matcher sameInstance
isn't a search manager. The workaround is to cast the matcher to remove the typing:
fromSearchManager:(id)sameInstance(_sm)
Now for the first argument: you may not need to make a custom matcher at all. If all you want to do is check a property value, use hasProperty
. Assuming the property is named accessory
,
zkZSensorFound:(id)hasProperty(@"accessory", sameInstance(accessory))
Putting it all together:
[verify(mockController)
zkZSensorFound:(id)hasProperty(@"accessory", sameInstance(accessory))
fromSearchManager:(id)sameInstance(_sm)];