Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 3996

The HttpCalloutMock interface enables sending fake responses when testing HTTP callouts in Salesforce.

6 votes
Accepted

Http callout test class "uncommitted work pending" error with no clear cause

Since you said in your comment that disabling workflows allows it to pass I am going to assume that some of those workflows are email alerts. This is a know issue which I first reported back in April …
Eric's user avatar
  • 54.4k
4 votes

Why Batch can't work in unit-test?

This one being the most relevant: Getting CalloutException when testing Batchable class with Callouts and HttpCalloutMock Regardless, in order to cover your batch class, instantiate the batch class and …
Eric's user avatar
  • 54.4k
3 votes

How to set an HttpCalloutMock to reply differently on subsequent requests to the same endpoint?

{ HttpResponse res; EchoMock(HttpResponse r) { res = r; } // This is the HttpCalloutMock interface method public HttpResponse respond(HttpRequest req … Once you've gotten as far as covering most of your code, the catch block should be pretty simple (hint: you can construct and throw CalloutException manually from a HttpCalloutMock). …
Eric's user avatar
  • 54.4k
2 votes
Accepted

Need help with Test Class for HTTP Callout

The MOCKHTTP class ss returning EXACTLY what the regular Endpoint would return. Since your class ClinicalStudySetupExtension.callRestEndPoint() is PRIVATE Method of ClinicalStudySetupExtension you s …
Eric's user avatar
  • 54.4k
2 votes
Accepted

HTTP Mock Response class has 0 coverage

Your Mock is annotated with isTest and thus does not count in overall coverage There is a small bug when creating classes in that if from an IDE you don't specify it is a test class and thus isTest i …
Eric's user avatar
  • 54.4k
2 votes

Test Class for HTTP Callout getting Zero Code Coverage

You are not actually testing anything in your MicFire class. All you are doing in your test method is creating new code. In addition the createAccount method does not cause anything in your class to e …
Eric's user avatar
  • 54.4k
0 votes

Sending attachment to JIRA From Salesforce Issue

JIRA Attachment POST requires a multi-part post....The HTTPRequest in salesforce does not eaisly support this. However this post has some information on doing this. I am not 100% (as I have not tried …
Eric's user avatar
  • 54.4k