I'm trying to use the mocking framework for unit tests I'm trying to make the property of a mock object return another mock object, but the behavior object doesn't have the property classdef MyClass properties (GetAccess=public, SetAccess=protected) prop1; end methods function this = answer() end end end this is the mock decleration: testCase = matlab.mock.TestCase.forInteractiveUse; [mock,behav] = testCase.createMock(?MyClass); % this would obciously throw an exception because the property set method is protected mock.prop1 = ""; You cannot set the read-only property 'prop1' of MyClassMock. % this throws an exception because the behavior object doesn't have this property p = behav.prop1; No appropriate method, property, or field 'prop1' for class 'matlab.mock.classes.MyClassBehavior'. now i can't set the value of the mock object because the set access is protected a
Welcome to top Matlab Articles Provider in World. We are a team of Matlab Experts available online 24x7. Get help in your Matlab Projects. matlabsolutions.com