title: How to Unit test the the strings are not nil which is parsed from JSON and stored in local string
body: <p>I am using AfNetworking and parsing JSON and storing the values in a NSArray. every thing works fine as usual. but now i want to know how can i do unit test and make sure the NSarrays are not nil</p>
  
  <p>i tried below, but the results are always nil</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import &lt;XCTest/XCTest.h&gt;
  #import "Media.h"
  
  @interface ModelUnitTest : XCTestCase
  @property (nonatomic, strong) Media * media;
  @end
  
  @implementation ModelUnitTest
  
  - (void)setUp {
      [super setUp];
   self.media = [[PPMedia alloc]init
      // Put setup code here. This method is called before the invocation of each test method in the class.
  }
  
  - (void)tearDown {
      // Put teardown code here. This method is called after the invocation of each test method in the class.
      [super tearDown];
  }
  
  - (void)testModelObject:(id)file
  {
      XCTAssertNotNil(self.media);
      XCTAssertTrue(self.media isKindOfClass:[Media class]]);
      XCTAssertNotNil(self.media.name);
      XCTAssertNotNil(self.media.sex);
      XCTAssertNotNil(self.media.description);
  }
  </code></pre>
  
  <p>I guess because the dictionary which holds the fetched data from JSON is not in this test file its showing nil, how do i handle this? i have to run Afnetworking and pull the dictionary in this testing file too or do i have any alternative way to test it.</p>
  
  <p>i am confused can any one help me.</p>