Package: matlab.mock.actions
Define return values for method called or property accessed
To specify the values that the framework returns when a mock
object method is invoked or a mock object property is accessed, use
the AssignOutputs
class.
If you call a mocked method with fewer outputs than specified
by AssignOutputs
, the remaining outputs are discarded.
If you call a mocked method with more outputs than specified by AssignOutputs
, MATLAB® throws
an error.
action = AssignOutputs(
defines
the values for the mock object to return for a method call or property
access. The A1,...,An
)AssignOutputs
constructor accepts one or
more values, A1,...,An
, that correspond to the
values for the output arguments of the mock object method or the value
of the mock object property.
Value. To learn how value classes affect copy operations, see Copying Objects.
For simple definition of outputs, you can use the assignOutputsWhen
method of the matlab.mock.TestCase
class.
However, there is more functionality when you use the AssignOutputs
action.
matlab.mock.MethodCallBehavior.when
| matlab.mock.PropertyGetBehavior.when
| matlab.mock.TestCase
| matlab.mock.actions.ThrowException