matlab.unittest.constraints.BooleanConstraint Class
Namespace: matlab.unittest.constraints
Superclasses: matlab.unittest.constraints.Constraint
Fundamental interface for constraints that support Boolean operations
Description
The matlab.unittest.constraints.BooleanConstraint
class provides an
interface that you can use to create constraints that can be combined and negated using the
and
(&
), or
(|
), and not
(~
) operators.
To create a custom constraint class that supports Boolean operations, derive your class
from matlab.unittest.constraints.BooleanConstraint
and implement the required
abstract methods:
Implement the
satisfiedBy
method to encode the comparison logic. TheBooleanConstraint
class inherits this method frommatlab.unittest.constraints.Constraint
.Implement the
getDiagnosticFor
method to produce diagnostic information when the testing framework evaluates the actual value against the constraint. TheBooleanConstraint
class inherits this method from theConstraint
class.Implement the
getNegativeDiagnosticFor
method to produce diagnostic information when the framework evaluates the actual value against the negated constraint. When a constraint is negated, the diagnostics must be written in a different form than for the standard (non-negated) usage.
Because the BooleanConstraint
class derives from the
Constraint
class, BooleanConstraint
subclasses support the
functionality provided by Constraint
subclasses. For example, you can use them
with the assertThat
, assumeThat
,
fatalAssertThat
, and verifyThat
qualification methods from
the matlab.unittest.qualifications
namespace.
Additionally, you can negate a BooleanConstraint
object or combine it with
other BooleanConstraint
objects.
Methods
Examples
Version History
Introduced in R2013a