matlab.mock.MethodCallBehavior Class
Namespace: matlab.mock
Specify mock object method behavior and qualify method calls
Description
Use the MethodCallBehavior object to specify
behavior for a mock object method and to qualify method calls.
There are several ways to define behavior for a mock object method.
Pass a mock object action, such as
matlab.mock.actions.AssignOutputs, to thewhenmethod of theMethodCallBehaviorclass.Pass a
MethodCallBehaviorobject to a method of thematlab.mock.TestCaseclass, such asassignOutputsWhen.
There are several ways to qualify interactions with the mock object method.
Pass a mock object constraint, such as
matlab.mock.constraints.WasCalled, to theverifyThat,assertThat,fatalAssertThat, orassumeThatmethod of thematlab.unittest.TestCase.Pass a
MethodCallBehaviorobject to a method of thematlab.mock.TestCaseclass, such asverifyCalledorassumeNotCalled.
Construction
The mocking framework constructs a MethodCallBehavior instance
when you call a method of the mock behavior object.
Methods
| when | Specify mock object method behavior |
| withAnyInputs | Specify mock object method call with any number of inputs with any value |
| withExactInputs | Specify mock object method call with only object as input |
| withNargout | Specify mock object method call with defined number of output arguments |
Copy Semantics
Value. To learn how value classes affect copy operations, see Copying Objects.
Version History
Introduced in R2017a