%% Specify Mock Method Behavior
% Create a mock for a triangle class. The mock has one method, sideLengths.

import matlab.mock.actions.AssignOutputs;
testCase = matlab.mock.TestCase.forInteractiveUse;
[mock,behavior] = testCase.createMock('AddedMethods',"sideLengths");

% Set up behavior. Regardless of the inputs to the sideLengths method, the mock returns the values 2, 3, and 4.

when(withAnyInputs(behavior.sideLengths),AssignOutputs(2,3,4))

% Call the sideLengths method of the mock object.

[a,b,c] = mock.sideLengths

% Call the sideLengths method again using different inputs and only two outputs.

[a,b] = mock.sideLengths(13,"inputText")

% Copyright 2012 The MathWorks, Inc.