matlab.mock.constraints.WasCalled Class
Namespace: matlab.mock.constraints
Constraint determining method call
Description
The WasCalled
constraint produces a qualification
failure if an actual value is not a MethodCallBehavior
instance,
or if the method that corresponds to the MethodCallBehavior
was
not called the specified number of times.
Construction
constraint = WasCalled
provides a constraint
that determines a method call. If a method was called at least once,
the constraint is satisfied. To qualify that a method was not called,
negate the WasCalled
constraint with the tilde (~
)
operator.
constraint = WasCalled('WithCount',
provides
a constraint that is satisfied when a method is called exactly n
)n
times.
If you negate WasCalled
with this syntax, if
the method was not called exactly n
times, the
constraint passes. For example, if a method was called four times, ~WasCalled('WithCount',3)
passes
and ~WasCalled('WithCount',4)
fails.
Input Arguments
Properties
Copy Semantics
Value. To learn how value classes affect copy operations, see Copying Objects.
Examples
Version History
Introduced in R2017a