Mockingbird Documentation 0.17.0

Function finite​Sequence(of:​)

public func finiteSequence<DeclarationType: Declaration, InvocationType, ReturnType>(
  of values: ReturnType...
) -> ImplementationProvider<DeclarationType, InvocationType, ReturnType>  

Stub a finite sequence of values.

Provide one or more values which will be returned sequentially for each invocation. The stub will be invalidated if the number of invocations is greater than the number of values provided.

given(bird.getName())
  .willReturn(finiteSequence(of: "Ryan", "Sterling"))

print(bird.name)  // Prints "Ryan"
print(bird.name)  // Prints "Sterling"
print(bird.name)  // Error: Missing stubbed implementation

Parameters

values Return​Type

A sequence of values to stub.