Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Platform Developer II All Questions

View all questions & answers for the Certified Platform Developer II exam

Exam Certified Platform Developer II topic 1 question 7 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 7
Topic #: 1
[All Certified Platform Developer II Questions]


The test method above calls a web service that updates an external system with Account information and sets the Account's Integration_Updated__c checkbox to
True when it completes. The test fails to execute and exits with an error: "Methods defined as TestMethod do not support Web service callouts. "
What is the optimal way to fix this?

  • A. Add Test.startTest() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate.
  • B. Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
  • C. Add if (!Test.isRunningTest()) around CalloutUtil.sendAccountUpdate.
  • D. Add Test.startTest() before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
ar9555
Highly Voted 3 years, 8 months ago
b is correct
upvoted 20 times
...
drwebber
Highly Voted 2 years, 11 months ago
B is the correct one
upvoted 8 times
...
FriedConsole2000
Most Recent 9 months, 1 week ago
Selected Answer: B
You need to set a mock.
upvoted 1 times
...
Ethan__O
9 months, 4 weeks ago
Selected Answer: B
The Test.setMock method is used to set up the mock response for the callout. This way, the test method doesn't actually make a real web service callout and will not generate an error.
upvoted 1 times
...
RuiR17
1 year, 1 month ago
B is the correct answer.
upvoted 1 times
...
sf2022
1 year, 11 months ago
Selected Answer: B
B is correct start.test setMock callout stop.test
upvoted 4 times
...
levian
2 years, 1 month ago
B correct
upvoted 1 times
...
Hello_Sfdc
3 years, 9 months ago
A?Test.setMock for callout?
upvoted 1 times
CraigJ
3 years, 6 months ago
A is calling the setMock AFTER the callout. B is correct
upvoted 4 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...