This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

matlab.mock.PropertySetBehavior class

Package: matlab.mock

Specify mock object set behavior


Use the PropertySetBehavior class to specify mock object set behavior. There are several ways to specify property set behavior.

  • Pass a mock object action, such as matlab.mock.actions.StoreValue, to the when method.

  • Pass a PropertySetBehavior object to a method of the matlab.mock.TestCase class, such as storeValueWhen.

To qualify mock property interactions, see matlab.mock.PropertyBehavior.


The mocking framework creates a PropertySetBehavior instance when you call the matlab.mock.PropertyBehavior.set or matlab.mock.PropertyBehavior.setToValue method. Typically, you construct the PropertySetBehavior implicitly. For example, testCase.throwExceptionWhen(set(behavior.MyProperty)).


whenSpecify mock object property set action

Copy Semantics

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

Introduced in R2017a