Package: matlab.mock
Specify mock object property behavior and qualify interactions
Use the PropertyBehavior
class to specify mock
object property behavior and qualify interactions.
There are several ways to qualify interactions with mock object properties.
Pass the PropertyBehavior
instance
to a method of the matlab.mock.TestCase
, such as verifyAccessed
or assumeNotSet
.
Pass the PropertyBehavior
instance
and a mock object constraint, such as matlab.mock.constraints.WasAccessed
,
to the verifyThat
, assertThat
, fatalAssertThat
,
or assumeThat
method of the matlab.unittest.TestCase
class.
To define behavior for a mock object property, you first need
a PropertyGetBehavior
or PropertySetBehavior
instance.
To create one of these instances, call a PropertyBehavior
method.
For more information on defining property behavior, see matlab.mock.PropertyGetBehavior
or matlab.mock.PropertySetBehavior
.
The mocking framework constructs a PropertyBehavior
instance
when you access a property on the mock behavior object.
get | Construct object to define mock property get behavior |
set | Construct object to define mock property set behavior |
setToValue | Construct object to define behavior when mocked property is set to specific value |
Value. To learn how value classes affect copy operations, see Copying Objects.
matlab.mock.constraints.Occurred
| matlab.mock.constraints.WasAccessed
| matlab.mock.constraints.WasSet
| matlab.mock.PropertyGetBehavior
| matlab.mock.PropertySetBehavior