All standard DDLog macros call +[DDLog log:level:flag:context:file:function:line:tag:format:] , so with OCMock you need to make sure that DDLogInfo was called:
- (void)testMethodCallsDDLogInfo { id mockDDLog = OCMClassMock([DDLog class]); [obj methodThatCallsDDLogInfo]; OCMVerify([mockDDLog log:YES level:DDLogLevelAll flag:DDLogFlagInfo context:0 file:[OCMArg anyPointer] function:[OCMArg anyPointer] line:58 tag:[OCMArg any] format:[OCMArg any]]); }
Unfortunately, with this strategy, you must hard-code multiple values, since there is no way in OCMock to specify a universal argument without a pointer.
source share