Salesforce PDII Question Answer
The test method calls an @future method that increments a value. The assertion is failing because the value equals 0. What is the optimal way to fix this?
Java
@isTest
static void testIncrement() {
Account acct = new Account(Name = 'Test', Number_Of_Times_Viewed__c = 0);
insert acct;
AuditUtil.incrementViewed(acct.Id); // This is the @future method
Account acctAfter = [SELECT Number_Of_Times_Viewed__c FROM Account WHERE Id = :acct.Id][0];
System.assertEquals(1, acctAfter.Number_Of_Times_Viewed__c);
}
Salesforce PDII Summary
- Vendor: Salesforce
- Product: PDII
- Update on: Dec 26, 2025
- Questions: 161

