when i trying to insert opportunity in my testclass i am getting an error
Test_opportunityTrigger.Test_opportunityTrigger: line 24, column 1
22:28:17.312 (312087000)|FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]
But i have name field in opportunity My code :
Opportunity op = new Opportunity();
op.RecordTypeId = rt.Id;
//op.AccountId = ac.id;
op.Name = 'OppName';
op.City__c = 'OppCty';
op.Postal_Code__c = '12345';
op.State__c = 'opp_sta';
op.Copy_Account_BA_to_SA__c = true;
op.Street__c = 'OppStr';
op.CloseDate = date.today();
op.StageName = 'No Decision';
op.Email_Field__c = 'xyz@gmail.com';
insert op;
Insert op is at line 24. Do anybody have any idea.