我是 OCMock 的初学者,我需要验证是否从另一个类调用了一个方法。以下是我的代码。
//Creating the OCMockObject
id mockProductRequest = [OCMockObject mockForClass:[ProductRequest class]];
[[mockProductRequest expect] testProductRequest];
//Creating the object where the mock object will be invoked
ProductService *actualService = [[ProductService alloc] init];
[actualService testProductService];
[mockProductRequest verify];
-(void)testProductService{
//Method where the mock object's method is invoked
ProductRequest *request = [[ProductRequest alloc] init];
[request testProductRequest];
}
我似乎总是收到一个方法未被调用的异常。请帮我弄清楚我在这里做错了什么。