You need to sign in to do that
Don't have an account?

Test Class for Opportunity Update
I have a test class where I am trying to cover code on an update trigger when the Effective Date or Stage is changed. However, when I run the test, none of the Opportunity data gets changed. Do I have the proper syntax in my test to test for a change to the Opportunity?
static testmethod void testAcctData(){ Account acct5 = TestCreateRecords.createAcct(0); insert acct5; Opportunity opp1 = TestCreateRecords.createOppNew(acct5.Id); insert opp1; Test.startTest(); Opportunity opp1a = [SELECT Id,Effective_Date__c,StageName FROM Opportunity WHERE Id =: opp1.Id]; opp1a.Effective_Date__c = Date.TODAY().addDays(5); opp1a.StageName = 'Phase 5: Closed Won'; UPDATE opp1a; Test.stopTest(); }
Cyrus T
Salesforce engineer
www.levementum.com