 
 final class NSFetchRequestResultUtilsTests: CoreDataPlusOnDiskTestCase {
   // MARK: - Batch Faulting
-
+  
   func testFaultAndMaterializeObjectWithoutNSManagedObjectContext() throws {
     let context = container.viewContext
-
+    
     // Given
     let sportCar1 = SportCar(context: context)
     sportCar1.maker = "McLaren"
     sportCar1.model = "570GT"
     sportCar1.numberPlate = "203"
     try context.save()
-
+    
     context.reset()
     XCTAssertTrue(sportCar1.isFault)
     XCTAssertNil(sportCar1.managedObjectContext)
-
+    
     // When
     try [sportCar1].materializeFaults()
     // Then
     XCTAssertFalse(sportCar1.isFault)
   }
-
+  
   func testFaultAndMaterializeTemporaryObject() throws {
     let context = container.viewContext
-
+    
     // Given
     let sportCar1 = SportCar(context: context)
     sportCar1.maker = "McLaren"
     sportCar1.model = "570GT"
     sportCar1.numberPlate = "203"
-
+    
     XCTAssertTrue(sportCar1.objectID.isTemporaryID)
     XCTAssertFalse(sportCar1.isFault)
-
+    
     // When
     sportCar1.fault()
     // Then
     XCTAssertTrue(sportCar1.isFault)
-
+    
     try [sportCar1].materializeFaults()
     XCTAssertFalse(sportCar1.isFault)
   }
-
+  
   func testBatchFaulting() throws {
     // Given
     let context = container.viewContext
-
-    context.performAndWait {
-      context.fillWithSampleData()
-      try! context.save()
-    }
-
+    
+    context.performAndWait {
+      context.fillWithSampleData()
+      try! context.save()
+    }
+    
     /// re-fault objects that don't have pending changes
     context.refreshAllObjects()
-
+    
     let request = Car.newFetchRequest()
     request.predicate = NSPredicate(value: true)
-
-
+    
+    
     // When
     let cars = try context.fetch(request)
-
+    
     /// re-fault objects that don't have pending changes
     context.refreshAllObjects()
-
+    
     let previousFaultsCount = cars.filter { $0.isFault }.count
-
+    
     /// batch faulting
     XCTAssertNoThrow(try cars.materializeFaults())
-
+    
     // Then
     let currentNotFaultsCount = cars.filter { !$0.isFault }.count
     let currentFaultsCount = cars.filter { $0.isFault }.count
     XCTAssertTrue(previousFaultsCount == currentNotFaultsCount)
     XCTAssertTrue(currentFaultsCount == 0)
-
-  }
-
+    
+  }
+  
   func testBatchFaultingEdgeCases() throws {
     // Given
     let context = container.viewContext

    XCTAssertEqual(newFCACount, fiatCount)
    XCTAssertEqual(result.changes?[NSUpdatedObjectsKey]?.count, nil) // wrong result type
  }

  func testbatchUpdateWithResultCountType() throws {
    // Given
    let context = container.viewContext
    context.fillWithSampleData()
    try context.save()

    let fiatPredicate = NSPredicate(format: "%K == %@", #keyPath(Car.maker), "FIAT")
    let fcaPredicate = NSPredicate(format: "%K == %@", #keyPath(Car.maker), "FCA")

    let fiatCount = try Car.count(in: context) { $0.predicate = fiatPredicate }
    let fcaCount = try Car.count(in: context) { $0.predicate = fcaPredicate }
    XCTAssertEqual(fcaCount, 0)

    let result = try Car.batchUpdate(using: context, resultType: .updatedObjectsCountResultType, propertiesToUpdate: [#keyPath(Car.maker): "FCA"], includesSubentities: true, predicate: fiatPredicate)
    XCTAssertEqual(result.count!, fiatCount)

    context.reset()
    let newFiatCount = try Car.count(in: context) { $0.predicate = fiatPredicate }
    XCTAssertEqual(newFiatCount, 0)

      XCTAssertTrue(car.objectID.isTemporaryID)
      context.delete(car)
    }
    
    /// new object added in the context before the fetch
    
    // first we materialiaze all cars
    XCTAssertNoThrow(try Car.fetch(in: context) { request in request.returnsObjectsAsFaults = false })
    let car = Car(context: context)
    car.numberPlate = "304"
    car.maker = "fake-maker"
    car.model = "fake-model"
    
    /// At this point we have two car with the same 304 number plate in the context, so the method will fetch one of these two.
    do {
      let car = try Car.findOneOrCreate(in: context, where: NSPredicate(format: "\(#keyPath(Car.numberPlate)) == %@", "304"), with: { car in
