• himanshu Chaurasia 4
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I've written the below code which looks fine as per the instructions given in the challenge.
But I'm facing an error when trying to resolve the challenge. Please help.

Error: Executing the 'generateRandomContacts' method failed. Either the method does not exist, is not static, or did not return the correct set of Contact records.

Code:

public class RandomContactFactory {
    
    public static List<Contact> generateRandomContacts(Integer n, String Lastname)
    {
        List<Contact> ct = new List<Contact>();
         Contact c = new Contact();
        for(Integer i=0; i<n; i++)
        {
           c.FirstName = 'Test '+i;
           c.LastName = Lastname;
           ct.add(c);
        }
        
        return ct;
    }

}