My problem is I am getting an error:
OCMckObject[NSNumberFormatter]: expected method was not invoked:setAllowsFloats:YES
I have written following Code:
(void) testReturnStringFromNumber
{
id mockFormatter = [OCMockObject mockForClass:[NSNumberFormatter class]];
StringNumber *testObject = [[StringNumber alloc] init];
[[mockFormatter expect] setAllowsFloats:YES];
[testObject returnStringFromNumber:80.23456];
[mockFormatter verify];
}
@implementation StringNumber
- (NSString *) returnStringFromNumber:(float)num
{
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setAllowsFloats:YES];
NSString *str= [formatter stringFromNumber:[NSNumber numberWithFloat:num]];
[formatter release];
return str;
}
@end