Main Content

matlab.mock.PropertyBehavior Class

Namespace: matlab.mock

Specify mock object property behavior and qualify interactions

Description

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.

Construction

The mocking framework constructs a PropertyBehavior instance when you access a property on the mock behavior object.

Methods

getConstruct object to define mock property get behavior
setConstruct object to define mock property set behavior
setToValueConstruct object to define behavior when mocked property is set to specific value

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects.

Version History

Introduced in R2017a