Nora_Maldonado | 2021-03-09 10:48:40 UTC | #1
Hello,
I need to implement a test class in salesforce to cover the code of another class that uses a APICall to purecloud.SDK.
Does anyone know what the mockcallout class is called in purecloud.sdk? I have tried to put the standard class but it does not work, it returns an error that a test class cannot make Callout calls. The class has the following code I have a campaign member insertion class in Genesys automatically that makes this call: public static ResultGenesysToolkit insertCampaignMember (List<InsertMemeberWrapper> lMember, Boolean priority) { //Load parameters on variables.... response = purecloud.SDK.Rest.post(URL,JSON.serialize(lObject));
from another @invocable class, I call a @future method to make the call to
// call to Genesys lResult = GenesysToolkit.insertCampaignMember(lInsert, w.priority);
Any help with this?
Thanks in advance
Junji_Sawada | 2021-03-16 17:49:00 UTC | #2
I found this Salesforce documentation.
Salesforce developer doc: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_static.htm
To mock a callout if the code that performs the callout is in a managed package, call Test.setMock from a test method in the same package with the same namespace.
So it seems today that there is no way to mock a callout made by the Genesys Cloud for Salesforce managed package as the package does not currently provide a way to call Test.setmock in the same package with the same namespace.
Junji
system | 2021-04-16 17:49:03 UTC | #3
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 10209