Consider this:
+(NSDictionary *)getDictionaryFromData:(id)data {
@synchronized(self) {
NSError *error = nil;
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
if (error) {
DLog(@"SERIALIZATION FAILED: %@", error.localizedDescription);
return nil;
}
DLog(@"SUCCESS: %@", dict);
return dict;
}
}
How do I mock getDictionaryFromData to get coverage if error is not nil? Is it possible or do I have to actually mock the JSONObjectWithData method?