Function verify(_:file:line:)
public func verify<ReturnType>(
_ declaration: @autoclosure () throws -> ReturnType,
file: StaticString = #file, line: UInt = #line
) -> VerificationManager<Any?, 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
Name | Type | Description |
---|---|---|
mock | A mocked declaration to verify. |