%% Assign Series of Outputs to Mock
% Create a mock for a bank account class.

testCase = matlab.mock.TestCase.forInteractiveUse;
[mock,behavior] = testCase.createMock('AddedMethods',"isOpen");

% Set up behavior to return true, true, and then false.

import matlab.mock.actions.AssignOutputs;
when(withExactInputs(behavior.isOpen), ...
    AssignOutputs(true).then(AssignOutputs(true)).then(AssignOutputs(false)))

% Use the mock.

isAccountOpen = mock.isOpen
isAccountOpen = mock.isOpen
isAccountOpen = mock.isOpen

% Copyright 2012 The MathWorks, Inc.