matlab.unittest.constraints.Constraint Class
Namespace: matlab.unittest.constraints
Fundamental interface for constraints
Description
The matlab.unittest.constraints.Constraint
class provides an interface that
you can use to encode comparison logic in qualifications and produce diagnostic information.
All constraints are derived from the Constraint
class, whether they are
user-supplied constraints or framework constraints.
To create a custom constraint class, derive your class from
matlab.unittest.constraints.Constraint
and implement its abstract methods:
Implement the
satisfiedBy
method to encode the comparison logic.Implement the
getDiagnosticFor
method to produce diagnostic information when the testing framework evaluates the actual value against the constraint.
Then, you can use your Constraint
subclass with the
assertThat
, assumeThat
, fatalAssertThat
,
and verifyThat
qualification methods from the matlab.unittest.qualifications
namespace.
To create a constraint that can be combined and negated using the and
(&
), or
(|
), and
not
(~
) operators, derive your class from matlab.unittest.constraints.BooleanConstraint
instead.
Class Attributes
Abstract | true |
HandleCompatible | true |
For information on class attributes, see Class Attributes.
Methods
Examples
Version History
Introduced in R2013a