 
     let kUserId = "11111"
     
-    var datafile: Data!
-    var optimizely: OptimizelyManager!
+    var datafile: Data?
+    var optimizely: OptimizelyManager?
+    var eventDispatcher:FakeEventDispatcher?
     
     // MARK: - SetUp
-    
     override func setUp() {
         super.setUp()
         
-        self.datafile = OTUtils.loadJSONDatafile("audience_targeting")
+        self.datafile = OTUtils.loadJSONDatafile("audience_targeting")!
+        
+        self.eventDispatcher = FakeEventDispatcher()
         
         self.optimizely = OptimizelyManager(sdkKey: "12345",
+                                            eventDispatcher:
+                                                self.eventDispatcher,
                                             userProfileService: OTUtils.createClearUserProfileService())
-        try! self.optimizely.initializeSDK(datafile: datafile)
+        try! self.optimizely!.initializeSDK(datafile: datafile!)
     }
 
     func testActivateWithNilAttributeValues() {

        ]
        
        do {
            let variationKey = try optimizely.activate(experimentKey: experimentKey, userId: kUserId, attributes: attributes)
            XCTAssert(variationKey == expectedVariationKey)
        } catch {
            XCTAssert(false)

    }

}

class FakeEventDispatcher : OPTEventDispatcher {

    public var events:[EventForDispatch] = [EventForDispatch]()
    required init() {
        
    }

    func dispatchEvent(event:EventForDispatch, completionHandler: @escaping DispatchCompletionHandler) {
        events.append(event)
        //completionHandler(event)
    }
    
    /// Attempts to flush the event queue if there are any events to process.
    func flushEvents() {
        
    }

}
