function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chris Walters 9Chris Walters 9 

execute a name of a function

I've crafted a map of names of testing functions win initial results:
     
        Map<String,Boolean> mapTestsToRun = new Map<String,Boolean>();
        mapTestsToRun.put('test_01',False);
        mapTestsToRun.put('test_02',False);
        mapTestsToRun.put('test_03',False);
        
And now I'd like to execute them

        for( String testToRun : mapTestsToRun.keySet()) {
            Boolean result = somethingCleverGoesHere( testToRun);
            mapTestsToRun.put( testToRun, result);
        }

But I need a way to execute a function by it's name. Any ideas?

TIA,

Chris
Chris Walters 9Chris Walters 9
And these are tests on live data, not unit tests, so the functions can return values.
Chris Walters 9Chris Walters 9
It seems like implementing the Callable interface would work, I'll try that.