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)

Accepted Answer

MathWorks Support Team
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.

More Answers (0)

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!