jonreid / OCMockito

Mockito for Objective-C: creation, verification and stubbing of mock objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expected nil, but was nil

pikaboo opened this issue · comments

How does this even happen?

Here is code to reproduce:

       _scriptManager = OCMPartialMock([ScriptsManager manager]);
   
       OCMStub([_scriptManager cachedData]).andReturn(nilValue());
       id expected = nilValue();
       id actual = [_scriptManager cachedData];
       assertThat(actual, equalTo(expected));

code from the library:

- (BOOL)matches:(id)item
{
    if (item == nil)
        return self.expectedValue == nil;
    return [item isEqual:self.expectedValue];
}

item == nil returns false

please see stackoverflow post below.

http://stackoverflow.com/a/5914886/2136812

What is the question? Is there an OCMockito issue?

The question is: why is nil != nil ?

Your example shows OCMock, not OCMockito. Do you have an OCMockito question?