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
Jhonatas Jesus 9Jhonatas Jesus 9 

please help created test class

public with sharing class CookbookBot_GetOpenAppointments {

  @InvocableMethod(label='Get Open Appointments')
  public static List<List<Bot_Appointment__c>> getOpenAppointments(List<String> sEmails) {

    String sEmail = sEmails[0];

    // Get the list of new and scheduled appointments
    List<Bot_Appointment__c> appointments = [SELECT Id, Name, JobType__c, 
                                                    AppointmentDate__c, AppointmentSlot__c 
                                             FROM Bot_Appointment__c 
                                             WHERE Contact__r.Email =:sEmail 
                                             AND Status__c IN ('New','Scheduled')];

    // Create a list for the appointments
    // NOTE: This is a list of lists in order to handle bulk calls...
    List<List<Bot_Appointment__c>> appointmentList = new List<List<Bot_Appointment__c>>();

    // Add all the new and scheduled appointments to the list
    appointmentList.add(appointments);

    return appointmentList;
  }
}

help!!!!
AnkaiahAnkaiah (Salesforce Developers) 
Hi Jhonatas,

try with below code and modify the field api names as per your org and set the test data for mandatory fields.
@isTest
private class CookbookBot_GetOpenAppointmentsTest {
    static testMethod void CookbookBotmethod(){
	
	List<string> eamils = new List<string>{'test@abc.com',bandi@gmail.com'};
	
	//insert the mandatory data.
	
	Account acc = new Account(Name='testacc');
	insert acc;
	
	Contact con = new contact(FirtstName ='Test',LastName='cont',AccountId=acc.id,email='test@abc.com');
	insert con;
        
		//insert the mandatory data
        Bot_Appointment__c ba = new Bot_Appointment__c (name='New bot opp',		                                               													   VConnect_Days__c='20'
													   JobType__c ='Contract',
													   AppointmentDate__c = system.today()+5,
													   AppointmentSlot__c =20,
													   Contact__c=con.id,
													   Status__c='New');
        insert ba;
		
		CookbookBot_GetOpenAppointments.getOpenAppointments(eamils);
		
        
     }
 }
let me know if any issues.

If this helps, Please mark it as best answer.

Thanks!!​​​​​​​
johnn devjohnn dev
public with sharing class BotInvocableKnowleFAQ {
    
    @InvocableMethod(label='Get Knowledge')
    public static List<List<Knowledge__kav>> getFAQ(List<String> sKeyword) {
        
        String key = sKeyword[0];
        
        List<List<Knowledge__kav>> searchList = [FIND :key IN ALL FIELDS 
                                      RETURNING Knowledge__kav(Id, Title, UrlName, Question__c, Answer__c) LIMIT 5];
        
        return searchList;
    }
}

I had made modifications to a sosl query and I don't know how to assemble the test class that way above can you help with this?