MATLAB: Do I see error failed since claNotify was not mocked while mocking axes

axesclanotifyfailedMATLABmockednotsincewas

I want to mock axes and call 'cla' on mocked axes.
 
%%setup test
import matlab.mock.actions.AssignOutputs;
testCase = matlab.mock.TestCase.forInteractiveUse;
[mockedAxes, behavior] = testCase.createMock(...
'AddedMethods',["isgraphics" "claNotify" "clo"]);
when(withAnyInputs(behavior.isgraphics),AssignOutputs(true));
%%use test
cla(mockedAxes) % -> failed since claNotify was not mocked
But while doing so, I am getting error-
failed since claNotify was not mocked
How to fix this?

Best Answer

The names of methods to add to mock in 'createMock' function do not include 'cla'.
I am assuming that there is typo there and you intended to use 'cla' instead of 'clo'-
[mockedAxes, behavior] = testCase.createMock(...
    'AddedMethods',["isgraphics" "claNotify" "clo"]);
Replace 'clo' with 'cla' and you should be able to call 'cla' on mocked axes.
This will resolve your problem.