matlab.unittest.diagnostics.ConstraintDiagnostic class

Package: matlab.unittest.diagnostics
Superclasses: matlab.unittest.diagnostics.Diagnostic

Diagnostics specific to matlab.unittest constraints

Description

The ConstraintDiagnostic class provides various textual fields that are common to most constraints. These fields may be turned on or off depending on their applicability.

The ConstraintDiagnostic class is a helper class for displaying diagnostics when using constraints. The ConstraintDiagnostic class provides custom constraint authors a way to add a common look and feel to diagnostics produced by the getDiagnosticFor method of constraints.

Constraint diagnostics are displayed in the following order: Description, Conditions, Actual Value, and Expected Value.

Properties

ActVal

The actual value passed to the constraint for testing.

ActValHeader

Header information for the actual value property, ActVal, specified as a string. The default header is 'Actual Value:'.

Conditions

Formatted list of conditions, specified as a single string. Each condition starts on a new line and begins with an arrow (-->) delimiter. Conditions are added to the list using the addCondition and addConditionsFrom methods.

ConditionsCount

Number of conditions in the condition list. This is a read-only property generated from the conditions list. The conditions list is defined in the Conditions property.

Description

General diagnostic information, specified as a string.

DisplayActVal

Indicator whether to display the actual value property, ActVal, specified as a boolean. By default, the actual value is not displayed and the value of this property is false.

DisplayConditions

Indicator of whether to display the Conditions property, specified as a boolean. By default, the conditions are not displayed and the value of this property is false. Even if DisplayConditions is set to true, if there are no conditions on the conditions list, neither the conditions header or the conditions list are displayed.

DisplayDescription

Indicator of whether to display the Description property, specified as a boolean. By default, the description is not displayed and the value of this property is false.

DisplayExpVal

Indicator whether to display the expected value property, ExpVal, specified as a boolean. By default, the expected value is not displayed and the value of this property is false.

ExpVal

If applicable, the expected value. This property can be turned off if the associated constraint does not contain an expected value.

ExpValHeader

Header information for the expected value property, ExpVal, specified as a string. The default header is 'Expected Value:'.

Inherited Properties

DiagnosticResult

The DiagnosticResult property provides the means by which the actual diagnostic information is communicated to consumers of diagnostics, such as testing frameworks. The property is a string that is defined during evaluation of the diagnose method.

Methods

addConditionAdd condition to condition list
addConditionsFromAdd condition from another ConstraintDiagnostic to condition list
getDisplayableStringConvert object to string for display
getPostActValStringReturns text to be displayed following actual value
getPostConditionStringReturns text to be displayed following conditions list
getPostDescriptionStringReturns text to be displayed following description
getPostExpValStringReturns text to be displayed following expected value
getPreDescriptionStringReturns text to be displayed prior to description

Inherited Methods

diagnoseExecute diagnostic action
joinJoin multiple diagnostics into a single array

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB® documentation.

Was this topic helpful?