StubberThrows

public struct StubberThrows<ReturnedValue>

Used to populate stubbed method with sequence of events. Call it’s methods, to record subsequent stub return/throw values.

  • Stubbing policy. If wrap - it will iterate over recorded values. If drop - it will remove value when stub returns. If default - it will use mock settings

    Declaration

    Swift

    public var policy: StubbingPolicy { get set }
  • [Internal] New instance of stubber class, used to populate products array

    Declaration

    Swift

    public init(_ method: StubbedMethod, returning: ReturnedValue.Type)

    Parameters

    method

    Stubbed method

    returning

    Return

  • Record return value

    Declaration

    Swift

    public func `return`(_ value: ReturnedValue)

    Parameters

    value

    return value

  • Record subsequent return values, in given order (comma separated)

    Declaration

    Swift

    public func `return`(_ values: ReturnedValue...)

    Parameters

    values

    return values

  • Record thrown error

    Declaration

    Swift

    public func `throw`(_ error: Error)

    Parameters

    error

    Error to throw

  • Record subsequent thrown errors, in given order (comma separated)

    Declaration

    Swift

    public func `throw`(_ errors: Error...)

    Parameters

    errors

    Errors to throw