Is it possible to create a function handle to a class property set method?
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur App Building dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!