yuezhong | 2021-07-09 04:04:05 UTC | #1
Hi We use the Genesys Cloud SDK for salesforce a lot. https://help.mypurecloud.com/articles/use-the-sdk-to-call-the-genesys-cloud-platform-api-in-salesforce/
We also write a lot Test method to for testing, and set Test.setMock(HttpCalloutMock.class, fakeResp); we keep get Methods defined as TestMethod do not support Web service callouts,
After reading the Apex Document.
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. "
We need the SDK to export a method allow us to set Mock class. Test.setMock(HttpCalloutMock.class, );
Please refer to below blog how they resolved the problem.
https://blog.moothien.me/2018/12/mock-http-callouts-in-managed-package.html?m=1
system | 2021-08-09 04:04:09 UTC | #2
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: 11435