You need to sign in to do that
Don't have an account?
Vserv Capital
I am write class leadhelper, how can write test class code
public class LeadHelper {
public static void createContact(List<Lead> leadList){
Id ContactRecordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('New').getRecordTypeId();
List<Contact> listCo=new List<Contact>();
for(Lead l : leadList){
Contact Con = new Contact();
Con.firstName = l.firstName;
Con.LastName = l.lastname;
Con.Email = l.Email;
Con.MobilePhone = l.MobilePhone.Substring(2,l.MobilePhone.length());
Con.RecordTypeId = ContactRecordTypeId;
Con.Source__c = 'Facebook';
Con.Project__c = l.Project__c;
Con.Address__c = l.Billing_City__c;
Con.Ad_Name__c = l.Ad_Name__c;
listCo.add(Con);
}
system.debug('listCo : ' + listCo);
insert listCo;
}
}
Please help me how can write test class code
public static void createContact(List<Lead> leadList){
Id ContactRecordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('New').getRecordTypeId();
List<Contact> listCo=new List<Contact>();
for(Lead l : leadList){
Contact Con = new Contact();
Con.firstName = l.firstName;
Con.LastName = l.lastname;
Con.Email = l.Email;
Con.MobilePhone = l.MobilePhone.Substring(2,l.MobilePhone.length());
Con.RecordTypeId = ContactRecordTypeId;
Con.Source__c = 'Facebook';
Con.Project__c = l.Project__c;
Con.Address__c = l.Billing_City__c;
Con.Ad_Name__c = l.Ad_Name__c;
listCo.add(Con);
}
system.debug('listCo : ' + listCo);
insert listCo;
}
}
Please help me how can write test class code
Let me know if it gives you any coverage
Anudeep
code give erorr
Static method cannot be referenced from a non static context: void LeadHelper.createContact(List<Lead>)
you can write test class like this
Thanks
Replace
with