Slide 34
Slide 34 text
// StubbableServiceClient
private var responseStubs: [ServiceClientStub] = [
]
func registerClientResponse
(
_ response: Response
,
for path: String
,
method: HTTPMethod
,
statusCode: Int
,
parameters: [String: Any] = [:]
,
fields: [GarageFieldDescriptor]? = nil
,
parametersMatchingPattern: ServiceClientStub.ParametersMatchingPattern
,
httpHeaders: [String: String]? = nil
)
{
let stub = ServiceClientStub
(
path: path
,
method: method
,
parameters: parameters
,
fields: fields
,
parametersMatchingPattern: parametersMatchingPattern
,
result: .success(response.jsonData)
,
urlResponse: makeURLResponse(path: path, statusCode: statusCode, httpHeaders:
httpHeaders
)
)
responseStubs.append(stub
)
}
StubbableServiceClient
ͷதͰStubΛอ࣋͢Δ
ϝιουɾPath͝ͱʹҰҙʹ
ͳΔΑ͏ʹϞοΫσʔλΛొ