You need to sign in to do that
Don't have an account?
Test Class not covering Class line of Contactrole__c
Hi All,
below is my test data for a class. the class doing some rollups based on created date. but in test class test data inserted and it's giving createddate value as null so it's not covering the lines in the class for Contactrole__c object. please give me the solution for this.
below is my test data for a class. the class doing some rollups based on created date. but in test class test data inserted and it's giving createddate value as null so it's not covering the lines in the class for Contactrole__c object. please give me the solution for this.
Contact_Role__c conrole= new Contact_Role__c(); conrole.Amount__c= 8000; conrole.Contact__c=con.Id; conrole.Opportunity__c=income.id; conrole.Role__c='Soft Credit'; conrole.Share__c=2; // conrole.CreatedDate =System.today(); insert conrole; system.debug('******+conrole' +conrole.CreatedDate); // Retuns Null conrole= [select Id, CreatedById ,CreatedDate from Contact_Role__c where Id =: conrole.Id limit 1]; system.debug('******+conrole' +conrole); //Returns Date
Yes you have query back to get the CreatedDate, please send me your actual class so that, will try to give you more inputs.
Regards,
Mahesh
Still didn't get the clear picture, what exactly the issue is.
If you can paste both the trigger / class, test class and which lines are not executing then will able to help you.
Regards,
Mahesh
Problem is line #6
LifetimeConMap.put((ID)LifetimeConRec.get('Opportunity__c'),LifetimeConRec);
is not covered in so the rollups related to this is in Red Part.
once this line is covered issue will be fixed..
Did you create the Opportunity record in your Test Class, please paste your full test class.
Regards,
Mahesh