You need to sign in to do that
Don't have an account?
chris_centra
test coverage - how to pull values from Process.PluginResult?
Hello -
i have a flow which is working well. I'm writing the test coverage - and i want to grab the results of the flow and review via system asserts. However i'm not sure how to pull the results from Process.PluginResult? I can output it:
System.Debug(' #### pluginResult:'+pluginResult);
And this shows the data that i'm expecting to see:
#### pluginResult:Process.PluginResult:[outputParameters={authStatus=Approved, transactionId=misc}]
But how do i pull that map from the PluginResult?
thanks for your time.
Chris
How about:
Map<String, Object> returnMap = pluginResult.outputParameters;
All Answers
I haven't tested this, but can you do:
pluginResult.getOutputParameters() ?
-cj
Hello. tried that - as well as a number of similar ideas, but none of them worked (specifically - getOutputParameters() gives a compile error). It is odd given - the way the PluginResult is built is to create a map and put values into it. So you would think that you do the get() as you describe - then get the individual values - but no good.
thanks
chris
How about:
Map<String, Object> returnMap = pluginResult.outputParameters;
Here is a sample snippet (which you need to clean up for your use case)
static testMethod void basicTestwithAccount() {
MyFlowPlugin aFlowPlugin = new MyFlowPlugin();
Map<String,Object> inputParams = new Map<String,Object>();
Map<String,Object> outputParams = new Map<String,Object>();
inputParams.put('Param1','val1');
inputParams.put('Param2','val2');Process.PluginRequest request = new Process.PluginRequest(inputParams);
Process.PluginResult result;
result = aFlowPlugin.invoke(request);
System.AssertEquals(result.size(), 3);
}