Mockingbird Documentation 0.14.1

Function verify(_:​file:​line:​)

public func verify<DeclarationType: Declaration, InvocationType, ReturnType>(_ declaration: Mockable<DeclarationType, InvocationType, ReturnType>, file: StaticString = #file, line: UInt = #line) -> VerificationManager<InvocationType, ReturnType>

Verify that a mock recieved a specific invocation some number of times.

Verification lets you assert that a mock received a particular invocation during its lifetime.

verify(bird.doMethod()).wasCalled()
verify(bird.getProperty()).wasCalled()
verify(bird.setProperty(any())).wasCalled()

Match exact or wildcard argument values when verifying methods with parameters.

verify(bird.canChirp(volume: any())).wasCalled()     // Called with any volume
verify(bird.canChirp(volume: notNil())).wasCalled()  // Called with any non-nil volume
verify(bird.canChirp(volume: 10)).wasCalled()        // Called with volume = 10

Parameters

mock

A mocked declaration to verify.