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.
@isTest
static void testAccountUpdate() {
Account acct = new Account({Name = ‘Test’);
acct.Integration Updated_c = false;
insert acct;
CalloutUtil.sendAccountUpdate (acct.Id);
Account acctAfter = [SELECT Id, Integration Updated_c FROM Account WHERE Id = :acct.Id] [0];
System.assert(true, acctAfter.Integration_Updated_c);
}
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 if (!Test.isRunningTest()) around CalloutUtil.sendAccountUpdate.
B . Add Test.startTest() before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
C . Add Test.startTest() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate.
D . Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
Answer: B
Latest PDII Dumps Valid Version with 280 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund