import matlab.mock.actions.StoreValue
import matlab.mock.actions.ThrowException
when(set(behavior.IsOpen),StoreValue().repeat(2).then(ThrowException( ...
MException('Account:setValue:tooMany','Value set too many times.'))))
モックを使用します。
for i = 1:3
mock.IsOpen = i
end
mock =
Mock with properties:
IsOpen: 1
mock =
Mock with properties:
IsOpen: 2
Error using matlab.mock.internal.MockContext/createMockObject/mockPropertySetCallback (line 429)
Value set too many times.
バージョン履歴
R2017a で導入
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します: