What is the optimal way to fix this?
The test method above calls an @future method that increments the Number_of_Times_Viewed__c value.
The assertion is failing because the Number_of_Times_Viewed__c equals 0.
@isTest
static void testIncrement() {
Account acct = new Account(Name = ‘Test’);
acct.Number_Of_Times_Viewed__c = 0;
insert acct;
AuditUtil.incrementViewed(acct.Id);
Account acctAfter = [SELECT Number_Of_Times_Viewed__c FROM Account WHERE Id =
:acct.Id][0]
System.assertEquals(1, acctAfter.Number_Of_Times_Viewed__c);
}
What is the optimal way to fix this?
A . Change the initialization to acct.Number_Of_Times_Viewed__c = 1.
B . Change the assertion to System.assertEquals(0, acctAfter.Number_Of_Times_Viewed__c).
C . Add Test.startTest() before and Test.stopTest() after AuditUtil.incrementViewed.
D . Add Test.startTest() before and Test.stopTest() after insert acct
Answer: A
Latest PDII Dumps Valid Version with 280 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund