You need to sign in to do that
Don't have an account?
Madevala Jithender
How do i write test class for Contact Search Method
public class ContactSearch {
public static list<contact> searchforcontacts(string lastname,string mailingpostalcode){
list<contact> contacts =
[select id,name,lastname,mailingpostalcode from contact where lastname = :lastname and mailingpostalcode = :mailingpostalcode];
system.debug('found contacts:' + contacts);
return contacts;
}
}
public static list<contact> searchforcontacts(string lastname,string mailingpostalcode){
list<contact> contacts =
[select id,name,lastname,mailingpostalcode from contact where lastname = :lastname and mailingpostalcode = :mailingpostalcode];
system.debug('found contacts:' + contacts);
return contacts;
}
}
Can you try the below test class with positive and negative test cases. It covers 100% of your code.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,