Package: matlab.mock
Specify mock object method behavior and qualify method calls
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 the when
method of the MethodCallBehavior
class.
Pass a MethodCallBehavior
object to
a method of the matlab.mock.TestCase
class, such as assignOutputsWhen
.
There are several ways to qualify interactions with the mock object method.
Pass a mock object constraint, such as matlab.mock.constraints.WasCalled
,
to the verifyThat
, assertThat
, fatalAssertThat
,
or assumeThat
method of the matlab.unittest.TestCase
.
Pass a MethodCallBehavior
object to
a method of the matlab.mock.TestCase
class, such as verifyCalled
or assumeNotCalled
.
The mocking framework constructs a MethodCallBehavior
instance
when you call a method of the mock behavior object.
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 |
Value. To learn how value classes affect copy operations, see Copying Objects.