How to read in a local JSON file for testing
问题 I'm trying to write unit tests for json validation (since the app heavily relies on json from a rest API). I have a local file that contains simple json: "goodFeaturedJson.txt" The contents: { "test": "TEST" } The test case: - (void)testJsonIsValid { Featured *featured = [Featured new]; NSString* filepath = [[NSBundle mainBundle]pathForResource:@"goodFeaturedJson" ofType:@"text"]; NSData *data = [NSData dataWithContentsOfFile:filepath]; NSString *jsonString = [[NSString alloc]