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
Michael ZimmersMichael Zimmers 

REST callouts and tests

Hi -

I'm trying to complete this trailhead:

https://trailhead.salesforce.com/modules/apex_integration_services/units/apex_integration_rest_callouts

And I must confess to being a little confused. In the tutorials, two kinds of test callouts are shown:
  1. StatResourceCalloutMock
  2. HttpCalloutMock
...but it's not clear to me which I should be using. So, I think my mock (and test) is sort of an incorrect hybrid (and it does fail). I'm trying to figure out the coding on my own, but can someone explain which test callout I should be using?

Thank you.
Best Answer chosen by Michael Zimmers
Michael ZimmersMichael Zimmers
Found the problem; I was indeed confusing the static resource approach with the HTTP callout. This was an excellent resource:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm