Package:matlab.mock
Match any number of arguments
Use theAnyArguments
class to match any number of arguments when specifying mock behavior or qualifying mock interactions.
AnyArguments
matches an unlimited, unspecified number of arguments, including zero. When defining mock behavior or qualifying mock interactions, specifyAnyArguments
as the last argument in the argument list.
Value. To learn how value classes affect copy operations, seeCopying Objects.
TheAnyArguments
class is functionally similar to using thewithAnyInputs
method of thematlab.mock.MethodCallBehavior
class. For example, the following code blocks are similar.
% Using the AnyArguments classimportmatlab.mock.AnyArguments; testCase.verifyCalled(behavior.myMethod(AnyArguments));% Using the withAnyInputs methodtestCase.verifyCalled(withAnyInputs(behavior.myMethod))
AnyArguments
requires that the mock is the first input argument, andwithAnyInputs
does not. TheMethodCallBehavior
class provides additional methods to specify behavior and record interactions, such as specification of exact inputs or a number of outputs.