 		service.authenticate("user", password: "pass").then { (token) in
 			service.getVehicles()
 			}.then { (vehicles) in
-				service.sendCommandToVehicle(vehicles[0], command: .ValetMode(options: options))
+				service.sendCommandToVehicle(vehicles[0], command: .valetMode(options: options))
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test valet")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandResetValetPin() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("ResetValetPin", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .ResetValetPin).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .ResetValetPin)
+		let stubPath = OHPathForFile("ResetValetPin.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .resetValetPin).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .resetValetPin)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test resetValet")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandOpenChargePort() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("OpenChargeDoor", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .OpenChargeDoor).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .OpenChargeDoor)
+		let stubPath = OHPathForFile("OpenChargeDoor.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .openChargeDoor).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .openChargeDoor)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test open charge door")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandChargeStandard() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("ChargeLimitStandard", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .ChargeLimitStandard).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .ChargeLimitStandard)
+		let stubPath = OHPathForFile("ChargeLimitStandard.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .chargeLimitStandard).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .chargeLimitStandard)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test charge standard")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandChargeMaxRate() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("ChargeLimitMaxRange", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .ChargeLimitMaxRange).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .ChargeLimitMaxRange)
+		let stubPath = OHPathForFile("ChargeLimitMaxRange.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .chargeLimitMaxRange).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .chargeLimitMaxRange)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test charge max range")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandChargePercentage() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("ChargeLimitPercentage", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri("/api/1/vehicles/1234567890/command/set_charge_limit"), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .ChargeLimitPercentage(limit: 10))
+		let stubPath = OHPathForFile("ChargeLimitPercentage.json", type(of: self))
+		_ = stub(condition: isPath("/api/1/vehicles/1234567890/command/set_charge_limit")) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .chargeLimitPercentage(limit: 10))
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test charge percentage")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandStartCharging() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("StartCharging", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .StartCharging).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .StartCharging)
+		let stubPath = OHPathForFile("StartCharging.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .startCharging).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .startCharging)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test start charging")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandStopCharging() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("StopCharging", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .StopCharging).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .StopCharging)
+		let stubPath = OHPathForFile("StopCharging.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .stopCharging).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .stopCharging)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test stop charging")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandFlashLights() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("FlashLights", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .FlashLights).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .FlashLights)
+		let stubPath = OHPathForFile("FlashLights.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .flashLights).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .flashLights)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test FlashLights")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandHonkHorn() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("HonkHorn", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .HonkHorn).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .HonkHorn)
+		let stubPath = OHPathForFile("HonkHorn.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .honkHorn).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .honkHorn)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test HonkHorn")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandUnlockDoors() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("UnlockDoors", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .UnlockDoors).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .UnlockDoors)
+		let stubPath = OHPathForFile("UnlockDoors.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .unlockDoors).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .unlockDoors)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test UnlockDoors")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandLockDoors() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("LockDoors", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .LockDoors).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .LockDoors)
+		let stubPath = OHPathForFile("LockDoors.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .lockDoors).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .lockDoors)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test LockDoors")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandSetTemperature() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("SetTemperature", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri("/api/1/vehicles/1234567890/command/set_temps"), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .SetTemperature(driverTemperature: 22.0, passangerTemperature: 23.0))
+		let stubPath = OHPathForFile("SetTemperature.json", type(of: self))
+		_ = stub(condition: isPath("/api/1/vehicles/1234567890/command/set_temps")) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .setTemperature(driverTemperature: 22.0, passangerTemperature: 23.0))
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test SetTemperature")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandStartAutoConditioning() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("StartAutoConditioning", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .StartAutoConditioning).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .StartAutoConditioning)
+		let stubPath = OHPathForFile("StartAutoConditioning.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .startAutoConditioning).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .startAutoConditioning)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test StartAutoConditioning")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandStopAutoConditioning() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("StopAutoConditioning", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .StopAutoConditioning).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .StopAutoConditioning)
+		let stubPath = OHPathForFile("StopAutoConditioning.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .stopAutoConditioning).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .stopAutoConditioning)
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test StopAutoConditioning")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandSetSunRoof() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("SetSunRoof", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri("/api/1/vehicles/1234567890/command/sun_roof_control"), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .SetSunRoof(state: .Open, percentage: 20.0))
+		let stubPath = OHPathForFile("SetSunRoof.json", type(of: self))
+		_ = stub(condition: isPath("/api/1/vehicles/1234567890/command/sun_roof_control")) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .setSunRoof(state: .Open, percentage: 20.0))
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test SetSunRoof")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandStartVehicle() {
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("StartVehicle", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri("/api/1/vehicles/1234567890/command/remote_start_drive"), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
-		
-		let service = TeslaSwift()
-		service.useMockServer = true
-		
-		service.authenticate("user", password: "pass").then { (token) in
-			service.getVehicles()
-			}.then { (vehicles)  in
-				service.sendCommandToVehicle(vehicles[0], command: .StartVehicle(password: "pass"))
+		let stubPath = OHPathForFile("StartVehicle.json", type(of: self))
+		_ = stub(condition: isPath("/api/1/vehicles/1234567890/command/remote_start_drive")) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
+		
+		let service = TeslaSwift()
+		service.useMockServer = true
+		
+		service.authenticate("user", password: "pass").then { (token) in
+			service.getVehicles()
+			}.then { (vehicles)  in
+				service.sendCommandToVehicle(vehicles[0], command: .startVehicle(password: "pass"))
 			}.then { (response) -> Void in
 				
 				XCTAssertEqual(response.result, false)
 				XCTAssertEqual(response.reason, "Test StartVehicle")
 				
 				expection.fulfill()
-			}.error { (error) in
-				print(error)
-				XCTFail((error as NSError).description)
-		}
-		
-		waitForExpectationsWithTimeout(2, handler: nil)
+			}.catch { (error) in
+				print(error)
+				XCTFail((error as NSError).description)
+		}
+		
+		waitForExpectations(timeout: 2, handler: nil)
 	}
 	
 	func testCommandOpenTrunk() {
 		
 		let options = OpenTrunkOptions.Rear
 		
-		let path = NSBundle(forClass: self.dynamicType).pathForResource("OpenTrunk", ofType: "json")!
-		let data = NSData(contentsOfFile: path)!
-		stub(uri(Endpoint.Command(vehicleID: 1234567890, command: .OpenTrunk(options: options)).path), builder: jsonData(data))
-		
-		let expection = expectationWithDescription("All Done")
+		let stubPath = OHPathForFile("OpenTrunk.json", type(of: self))
+		_ = stub(condition: isPath(Endpoint.command(vehicleID: 1234567890, command: .openTrunk(options: options)).path)) {
+			_ in
+			return fixture(filePath: stubPath!, headers: self.headers)
+		}
+		
+		let expection = expectation(description: "All Done")
 		
 		let service = TeslaSwift()
 		service.useMockServer = true

				
				XCTAssertEqual(response.accessToken, "abc123-mock")
				expection.fulfill()
			}.error { (error) in
				print(error)
		}
		
		waitForExpectationsWithTimeout(2, handler: nil)
		
	}
	
	func testAuthenticationFailed() {
		
		let path = NSBundle(forClass: self.dynamicType).pathForResource("AuthenticationFailed", ofType: "json")!
		let data = NSData(contentsOfFile: path)!
		stub(uri(Endpoint.Authentication.path), builder: jsonData(data, status: 401))
		
		let expection = expectationWithDescription("All Done")
		
		let service = TeslaSwift()
		service.useMockServer = true

				expection.fulfill()
		}
		
		waitForExpectations(timeout: 2, handler: nil)
		
	}
	
	func testReuseToken() {
		
		let expection = expectation(description: "All Done")
		
		let service = TeslaSwift()
		service.useMockServer = true
		
		_ = service.authenticate("user", password: "pass")
			.then {
				(_) -> Void in
				
				service.checkToken().then { (response) -> Void in
					
					XCTAssertTrue(response)
					expection.fulfill()
					
					}.catch { (error) in
						XCTFail("Token is not valid: \((error as NSError).description)")
				}
				
		}
		
		waitForExpectations(timeout: 2, handler: nil)
		
	}
	
	func testGetVehicles() {
		
		let expection = expectation(description: "All Done")
		
		let service = TeslaSwift()
		service.useMockServer = true
		
		_ = service.authenticate("user", password: "pass")
			.then {
				(_) -> Void in
				service.getVehicles()
