How do I construct test cases derived from the matlab.unittest.TestCase class for private methods in MATLAB 8.1 (R2013a)?
1 view (last 30 days)
Show older comments
I would like to construct test cases derived from the matlab.unittest.TestCase class for private methods. How do I do this?
Accepted Answer
MathWorks Support Team
on 20 May 2013
In MATLAB, you can specify the classes that are allowed to access a private method in the 'Access' attribute statement. Suppose MyTestCase is derived from the matlab.unittest.TestCase class in the following example:
methods( Access = ?MyTestCase )
function obj = objMethod(obj)
%do something
end
end
This allows MyTestCase to access the private method objMethod.
0 Comments
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!