title: NSManagedObject subclass mocking
body: <p>I am writing XCTest cases but I am stuck at one place.
  I have a Class Car in my main target which is subclass of NSManagedObject. I am creating mock which will have array of objects of Car class. But whenever I use setter for elements of Car it get crash.</p>
  
  <p>In Main Target</p>
  
  <pre><code>class Car: NSManagedObject {
  
      @NSManaged var name: String
  
  }
  </code></pre>
  
  <p>In Test Target</p>
  
  <pre><code>class CarTests: XCTestCase {
  
  
  
      func testCar() {
  
          let car = getMyCar()
          // Some asserts here
  
      }
  
      func getMyCar() -&gt; Car {
          let car: Car = Car.Init()
          car.name = "Ferrari"
  
          return car
      }
  
  }
  </code></pre>
  
  <p>Here it crash when I set car name. Any Idea how I can create mock data of car object?</p>
  
  <p>error - failed: caught "NSInvalidArgumentException", "-[MyProject.Car setName:]: unrecognized selector sent to instance 0x310434347f200"</p>