Testing class method using OCMock release 2.1.1
问题 I am trying to check if a class method is getting invoked using OCMock. I have gathered from OCMock website and other answers on SO that the new OCMock release (2.1) adds support for stubbing class methods. I am trying to do the same: DetailViewController: +(BOOL)getBoolVal { return YES; } Test Case: -(void) testClassMethod { id detailMock = [OCMockObject mockForClass:[DetailViewController class]]; [[[detailMock stub] andReturnValue:OCMOCK_VALUE((BOOL){YES})] getBoolVal:nil]; } The test is