Main Content
matlab.mock.AnyArguments Class
Namespace: matlab.mock
Match any number of arguments
Description
Use the AnyArguments
class to match any number
of arguments when specifying mock behavior or qualifying mock interactions.
Construction
AnyArguments
matches
an unlimited, unspecified number of arguments, including zero. When
defining mock behavior or qualifying mock interactions, specify AnyArguments
as
the last argument in the argument list.
Copy Semantics
Value. To learn how value classes affect copy operations, see Copying Objects.
Examples
Alternatives
The AnyArguments
class is functionally similar
to using the withAnyInputs
method of the matlab.mock.MethodCallBehavior
class.
For example, the following code blocks are similar.
% Using the AnyArguments class import matlab.mock.AnyArguments; testCase.verifyCalled(behavior.myMethod(AnyArguments)); % Using the withAnyInputs method testCase.verifyCalled(withAnyInputs(behavior.myMethod))
AnyArguments
requires that
the mock is the first input argument, and withAnyInputs
does
not. The MethodCallBehavior
class provides additional
methods to specify behavior and record interactions, such as specification
of exact inputs or a number of outputs.Version History
Introduced in R2017a