You need to sign in to do that
Don't have an account?
Ronaldo Costa
Trigger Opportunity test class @80%
Hello all,
Please review the code below, I don't get why its not passing 100%
Trigger:
@test Class
I highlighted the line "fi.add (new Itinerary__c(" which is not passing.
Thanks a lot!
Ronaldo.
Please review the code below, I don't get why its not passing 100%
Trigger:
trigger CreateFlightItinerary on Opportunity (after update) { List<Itinerary__c> fi = new List<Itinerary__c>(); for (Opportunity a: Trigger.New) if (a.fi_automation_check__c == TRUE){ fi.add (new Itinerary__c( Flight_Booking__c = a.Id, Stop_1__c = a.Stop1_ID__c, Flight_Crew_1__c = a.CrewM_1_ID__c )); } insert fi; }
@test Class
@isTest private class testCreateFlightItinerary{ static TestMethod void myTestClass() { Account a = new Account(); a.Name = 'TestName'; a.Phone = '5512991224391'; insert a; Opportunity o = new Opportunity(); o.Name = 'TestName'; o.AccountID = a.Id; o.closedate = system.today(); o.stagename = 'Sample Quote'; o.Aircraft_Type__c = 'King Air'; insert o; Itinerary__c i = new Itinerary__c(); i.Flight_Booking__c = o.Id; insert i; } }
I highlighted the line "fi.add (new Itinerary__c(" which is not passing.
Thanks a lot!
Ronaldo.
try below code .