MockedType
public protocol MockedType: class
Use for mocking static methods, all methods in this protocol are implemented in extension and should not be implemented by conforming type
-
registerSelector(_:)
Default implementationRegisters simple selector call
Default Implementation
Do not implement in mock
Do not implement in mock
Declaration
Swift
static func registerSelector(_ selector: Selector)
Parameters
selector
selector to register
#selector(functionSelector)
-
registerSelector(_:params:)
Default implementationRegisters selector call with parameters
Default Implementation
Do not implement in mock
Do not implement in mock
Declaration
Swift
static func registerSelector(_ selector: Selector, params: [Any?]?)
Parameters
selector
selector to register
#selector(functionSelector(params:))
params
array of parameters received in function
-
Registers simple selector call and returns stubbed value
Declaration
Swift
static func registerSelector<T>(_ selector: Selector) -> T?
Parameters
selector
selector to register
#selector(functionSelector)
Return Value
value stubbed with
stubValueForSelector
-
Registers selector call with parameters and returns stubbed value
Declaration
Swift
static func registerSelector<T>(_ selector: Selector, params: [Any?]?) -> T?
Parameters
selector
selector to register
#selector(functionSelector(params:))
params
array of parameters received in function
Return Value
value stubbed with
stubValueForSelector
-
numberOfCallsForSelector(_:)
Default implementationQueries for number of calls for given selector
Default Implementation
Do not implement in mock
Declaration
Swift
static func numberOfCallsForSelector(_ selector: Selector) -> Int
Parameters
selector
selector to query against `#selector(functionSelector
-
parametersForSelector(_:)
Default implementationQueries for parameters passed to given selector on its last invocation
Default Implementation
Do not implement in mock
Declaration
Swift
static func parametersForSelector(_ selector: Selector) -> [Any?]?
Parameters
selector
selector to query against
#selector(functionSelector)
Return Value
array of parameters passed to function
-
stubbedValueForSelector(_:)
Default implementationQueries for stubbed values for given selector
Default Implementation
Do not implement in mock
Declaration
Swift
static func stubbedValueForSelector<T>(_ selector: Selector) -> T?
Parameters
selector
selector to query against
#selector(functionSelector)
Return Value
stubbed value
-
stubValueForSelector(_:_:)
Default implementationStub value for given selector
Default Implementation
Do not implement in mock
Declaration
Swift
static func stubValueForSelector(_ selector: Selector, _ value: Any?)
Parameters
selector
selector to stub value for
#selector(functionSelector)
value
return value to stub
-
stopMocking()
Default implementationStop mocking given object. Will clear stubbed return values, selector calls and parameters
Default Implementation
Do not implement in mock
Declaration
Swift
static func stopMocking()