Hallo,
I am trying to set up some unit tests for code that accepts an *NSError as an argument. If there is a validation problem, then the object is not saved and the NSError condition is set.
My method is:
- (BOOL)validateConsistency:(NSError **)error {
... code omitted for brevity ...
if (errorCondition == YES) {
NSMutableDictionary *errorDetail = [NSMutableDictionary dictionary];
[errorDetail setValue:@"Validation failed " forKey:NSLocalizedDescriptionKey];
*error = [NSError errorWithDomain:@"myDomain" code:100 userInfo:errorDetail];
return nil;
}
...
}
Once I've created the conditions that should generate this error, how can I STAssert/test for it in my unit tests?
Thanks.