Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam Platform Developer II Topic 1 Question 109 Discussion

Actual exam question for Salesforce's Platform Developer II exam
Question #: 109
Topic #: 1
[All Platform Developer II Questions]

Refer to the test method below''

The test method calls a web service that updates an external system with Account

information and sets the Accounts 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.''

A)

B)

C)

D)

Show Suggested Answer Hide Answer
Suggested Answer: C

The correct feature to use is C, Named Credentials. Named Credentials are a secure way of storing the endpoint and authentication details for callouts to external services. When URLs change frequently, using Named Credentials allows you to manage the endpoint URL in one place without changing the Apex code.


Named Credentials

Contribute your Thoughts:

Melinda
4 days ago
Option B looks like the way to go. Separating the web service call into a different method seems like the obvious solution here.
upvoted 0 times
...
Larae
5 days ago
Ah, I see the issue now. We need to move the web service call out of the test method and into a separate method. *chuckles* Rookie mistake, am I right?
upvoted 0 times
...
Silva
7 days ago
Wait, did they just say 'Methods defined as TestMethod do not support Web service callouts'? That's a pretty clear error message if you ask me.
upvoted 0 times
...
Clare
15 days ago
I believe we can use a mock callout to simulate the web service response and make the test method pass.
upvoted 0 times
...
Meghan
17 days ago
Hmm, looks like we can't use web service callouts in test methods. Guess we'll have to find another way to test this functionality.
upvoted 0 times
...
Craig
19 days ago
I agree with Geoffrey. We need to find a way to handle the web service callouts in the test method.
upvoted 0 times
...
Geoffrey
21 days ago
I think the error is due to the test method not supporting web service callouts.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77