Types

  • Every generated mock implementation adopts Mock protocol. It defines base Mock structure and features.

    See more

    Declaration

    Swift

    public protocol Mock: class
  • Every mock, that stubs static methods, should adopt StaticMock protocol. It defines base StaticMock structure and features.

    Declaration

    Swift

    public protocol StaticMock: class
  • Parameter wraps method attribute, allowing to make a difference between explicit value, expressed by .value case and wildcard value, expressed by .any case.

    Whole idea is to be able to test and specify behaviours, in both generic and explicit way (and any mix of these two). Every test method matches mock methods in signature, but changes attributes types to Parameter.

    That allows pattern like matching between two Parameter values:

    • .any is equal to every other parameter. (!!! actual case name is ._, but it is advised to use .any)
    • .value(p1) is equal to .value(p2) only, when p1 == p2

    Important! Comparing parameters, where ValueType is not Equatable will result in fatalError, unless you register comparator for its ValueType in Matcher instance used (typically Matcher.default)

    • any: represents and matches any parameter value
    • value: represents explicit parameter value
    See more

    Declaration

    Swift

    public enum Parameter<ValueType>
  • Matcher is container class, responsible for storing and resolving comparators for given types.

    See more

    Declaration

    Swift

    public class Matcher
  • [Internal] Used to wrap generic parameters, for sake of generic method stubs.

    Declaration

    Swift

    public struct GenericAttribute: GenericAttributeType
  • [Internal] Used as generic constraint for generic method stubs.

    Declaration

    Swift

    public protocol GenericAttributeType