I have a class that looks the following:
public class ChatBot_GetLocalAndTripID {
public class ChatBotInput{
@InvocableVariable(required=true)
public string SelectedStrips;
}
public class ChatBotOutput{
@InvocableVariable(required=true)
public string LocalCallCenter;
@InvocableVariable(required=true)
public string TripID;
}
@InvocableMethod(Label = 'Get Trip Info' description='Get a list of Trips From BO for specific user')
public static List<ChatBotOutput> GetTrips (List <ChatBotInput> SelectedStrips){
system.debug(SelectedStrips);
ChatBotOutput result = new ChatBotOutput();
result.LocalCallCenter = 'Israel';
result.TripID = '34344344';
return new List<ChatBotOutput> {result};
}
}
It is expecting a list of ChatBotInput ...
In my test I am getting the error:
Method does not exist or incorrect signature: void GetTrips(List<chatBot_GetLocalAndTripsIDTest.ChatBotInput>) from the type ChatBot_GetLocalAndTripID`
Please explain me what I do not understand here ? here is my test:
@isTest
public class chatBot_GetLocalAndTripsIDTest {
public class ChatBotInput{
public string SelectedStrips;
}
@isTest static void testMethodCon() {
List<ChatBotInput> toInput = new List<ChatBotInput>();
ChatBotInput SelectedTrip = new ChatBotInput();
SelectedTrip.SelectedStrips = 'Athens - 2022-06-30';
toInput.add(SelectedTrip);
//ChatBotInput result = new ChatBotInput();
Test.startTest();
system.debug('Start testing');
ChatBot_GetLocalAndTripID.GetTrips(toInput);
Test.stopTest();
}
}
Working Test:
@isTest
public class chatBot_GetLocalAndTripsIDTest {
@isTest static void testMethodCon() {
List <ChatBot_GetLocalAndTripID.ChatBotInput> finalInput = new List <ChatBot_GetLocalAndTripID.ChatBotInput>();
ChatBot_GetLocalAndTripID.ChatBotInput toInput = new ChatBot_GetLocalAndTripID.ChatBotInput();
toInput.SelectedStrips = 'Athens - 2022-06-30';
finalInput.add(toInput);
Test.startTest();
system.debug('Start testing');
ChatBot_GetLocalAndTripID.GetTrips(finalInput);
Test.stopTest();
}
}