2

I have a class that suppose to return a string when a method gets called. How can i create a mock object.

I want mock to return @"Hello" when the method "sayHello" get's called

id mock = [OCMockObject mockForClass:[MyCrazyClass class]];
4

1 回答 1

5
[[[mock stub] andReturn:@"Hello"] yourMethod:someArgument];
于 2011-03-30T22:27:10.290 回答