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 thewhen
method of theMethodCallBehavior
class.Pass a
MethodCallBehavior
object to a method of thematlab.mock.TestCase
class, 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
, orassumeThat
method of thematlab.unittest.TestCase
.Pass a
MethodCallBehavior
object to a method of thematlab.mock.TestCase
class, such asverifyCalled
orassumeNotCalled
.
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