You need to sign in to do that
Don't have an account?
Chris 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
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 9
And these are tests on live data, not unit tests, so the functions can return values.
Chris Walters 9
It seems like implementing the Callable interface would work, I'll try that.