Is it possible to create a function handle to a class property set method?
显示 更早的评论
Probably a stupid question and I've searched the web and Matlab help for an hour with different search terms without luck so either this is so stupid no-one would ever consider doing it or I didn't get the right search terms!
I am writing a unit test for a class and I have a property set method which uses validateattributes to check what is being set.
I want a unit test to verify that an exception is thrown when I try to set invalid data. I have tried a load of variations around the following theme, this possibly not being the most intelligent...
testCase.assertError( @()testCase.traceDemo.set.traceData( myData ),?MException );
I can test for a more specific exception, but that isn't the problem other than that the test passes because it throws a syntax exception. My problem is getting the function handle to call the set property.
Is this possible?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 App Building 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!