User`s guide
Language and Programming
1-9
Unit Testing Framework: Compare objects using isequaln
When the class of the expected value defines an isequaln method, the
ObjectComparator uses that method for object comparison.
In previous releases, ObjectComparator used isequal to compare all objects. The
IsEqualTo constraint and the assertEqual, assumeEqual, fatalAssertEqual,
and verifyEqual qualification methods leverage ObjectComparator and, therefore,
inherit the same change in behavior. For more information, see ObjectComparator.
Compatibility Considerations
Rewrite your tests to force a comparison with isequal when you use
ObjectComparator to compare objects of a class that defines isequaln and you rely on
the results of isequal instead of isequaln.
For example, if the class of expObj defines isequaln, then
testCase.verifyEqual(actObj,expObj) uses isequaln for comparison, but
testCase.verifyReturnsTrue(@()isequal(actObj,expObj)) uses isequal.
Similarly, testCase.verifyThat(actObj,IsEqualTo(expObj)) uses isequaln for
comparison, but
testCase.verifyThat(@()isequal(actObj,expObj),ReturnsTrue) uses
isequal.
Unit Testing Framework: Use homogeneous expected causes with
Throws constraint
When you specify expected causes using the 'CausedBy' name-value pair argument
in the Throws constraint, the causes must be a cell array of strings or an array of
meta.class instances.
In previous releases, you specified the value of 'CausedBy' as a cell array that
could contain both strings and meta.class instances. For more information, see
matlab.unittest.constraints.Throws.
Compatibility Considerations
Rewrite tests that use the Throws constraint and specify heterogeneous data types for
'CausedBy'. If you cannot define expected causes using either a cell array of strings