} class APIClientMock: APIClientProtocol { subscript(request: HTTPRequest) -> Response { get { return requestToJSONMap[request.hash]! } set(newValue) { requestToJSONMap[request.hash] = newValue } } func send<T: Decodable>(request: HTTPRequest) -> Future<T, Error> { switch self[request] { case .success(let json): return Future(value: try! decodeJSON(from: json.fileName) as T) case .failure(let failure): return Future(error: generateError(from: failure)) } } }