ProcessHandlerShowAccounts class works, but I am trying to get my test class up to par to validate my data. I am getting a variable does not exist, not sure why Did I initiate the class wrong?
Also when I call the method from the test class handleNewAccounts with an array of object as a paramter, is it okay to pass it a LIST will this be an issue moving forward?
public class ProcessHandlerShowAccounts
{
public class AccountParameter
{
@InvocableVariable(required=true)
public Id accountId;
@InvocableVariable(required=true)
public String name;
}
@InvocableMethod
public static void handleNewAccounts(AccountParameter [] accountParameters)
{
System.debug('Account Id: '+accountParameters[0].accountId);
System.debug('Name: '+accountParameters[0].name);
}
}
//Test Class
@isTest
public class ERPTestClass {
@isTest static void testhandleNewAccounts()
{
ProcessHandlerShowAccounts p = new ProcessHandlerShowAccounts();
List<ProcessHandlerShowAccounts.AccountParameter> testAcctList = new List <ProcessHandlerShowAccounts.AccountParameter>();
//accountId & name variables do not exist
testAcctList.accountId.add('0011C000WW210zZ5');
testAcctList.name.add('create');
ProcessHandlerShowAccounts.handleNewAccounts(testAcctList);
}
}