function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
akhil g 6akhil g 6 

Help me to create test class for below code

public class RandomContactFactory {
    public static List<contact> generaterandomcontacts(Integer numberofcontacts,string lastnames){
        List<contact> contacts = new List<contact>();
        for(integer i=0;i<numberofcontacts;i++){
            contact con = new contact(FirstName = 'Test'+i,Lastname = lastnames);
            contacts.add(con);
        }
        return contacts;
    }

}
Best Answer chosen by akhil g 6
SANDEEP CHITTINENISANDEEP CHITTINENI
@isTest
public class Test_RandomContactFactory{
static testmethod void test1(){
RandomContactFactory.generaterandomcontacts(10, 'Test name');
}
}

This will give 100% code coverage.