         XCTAssertEqual(dataSource.logger, self.logger)
     }
     
+    
+    func test_FetcherDataSource_refresh_mustSucceed() {
+        let dataSource = self.createFetcherDataSourceDesignatedInitializer()
+        dataSource.sortDescriptors = []
+        do {
+            try dataSource.refreshData()
+            XCTAssertTrue(true)
+        } catch {
+            XCTAssertTrue(false)
+        }
+    }
+    
+    
+    func test_FetcherDataSource_refresh_mustIgnoreExceptionCrash() {
+        let dataSource = self.createFetcherDataSourceDesignatedInitializer()
+        dataSource.sortDescriptors = [ NSSortDescriptor(key: "nonExistingField", ascending: true) ]
+        dataSource.predicate = nil
+        
+        do {
+            try dataSource.refreshData()
+            XCTAssertTrue(true)
+        } catch {
+            XCTAssertTrue(false)
+        }
+    }
+   
+
+    func test_FetcherDataSource_objectAtIndexPath_mustReturnEntity() {
+        let dataSource = self.createFetcherDataSourceDesignatedInitializer()
+        dataSource.sortDescriptors = [ NSSortDescriptor(key: "order", ascending: true) ]
+        self.removeAllTestEntities()
+        
+        let entityTest0 = self.createTestEntity(nil, name: "EntityTest-0", order: 0)
+        self.createTestEntity(nil, name: "EntityTest-1", order: 1)
+        self.coreDataStack.saveContext()
+        do {
+            try dataSource.refreshData()
+            XCTAssertTrue(true)
+        } catch {
+            XCTAssertTrue(false)
+        }
+        
+        let indexPath = NSIndexPath(forRow: 0, inSection: 0)
+        let entityAtIndexPath = dataSource.objectAtIndexPath(indexPath)
+        XCTAssertEqual(entityAtIndexPath, entityTest0!)
+    }
+    
+    
+    func test_FetcherDataSource_indexPathForObject_mustSucceed() {
+        let dataSource = self.createFetcherDataSourceDesignatedInitializer()
+        dataSource.sortDescriptors = [ NSSortDescriptor(key: "order", ascending: true) ]
+        self.removeAllTestEntities()
+        
+        let entityTest0 = self.createTestEntity(nil, name: "EntityTest-0", order: 0)
+        self.createTestEntity(nil, name: "EntityTest-1", order: 1)
+        self.coreDataStack.saveContext()
+        do {
+            try dataSource.refreshData()
+            XCTAssertTrue(true)
+        } catch {
+            XCTAssertTrue(false)
+        }
+        
+        let entityIndexPath = dataSource.indexPathForObject(entityTest0!)!
+        let indexPath = NSIndexPath(forRow: 0, inSection: 0)
+        XCTAssertEqual(entityIndexPath, indexPath)
+    }
+    
 }

import CoreData
import York

class FetcherDataSourceTests: XCTestCase {

    var entityName: String!
    var predicate: NSPredicate?
    var fetchLimit: NSInteger?
    var sortDescriptors: [NSSortDescriptor]!
    var sectionNameKeyPath: String?
    var cacheName: String?
    var coreDataStack: CoreDataStack!
    var managedObjectContext:NSManagedObjectContext!
    var logger:Logger!
    
    func createFetcherDataSourceConvenienceInitializer() -> FetcherDataSource<EntityTest> {
        self.entityName = EntityTest.simpleClassName()
        self.sortDescriptors = []
        self.coreDataStack = TestUtil().appContext().coreDataStack
        self.managedObjectContext = self.coreDataStack.managedObjectContext
        self.logger = Logger()
        self.predicate = nil

    }
    
    
    // MARK: - Tests - Initialization
    
    func test_convenienceInitializer_FetcherDataSourceFields_entityName() {
        let dataSource = self.createFetcherDataSourceConvenienceInitializer()
        XCTAssertEqual(dataSource.entityName, self.entityName)
