• Clinton Hatcher
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi all, i am new to this so thanks in advance for help. I am struggling to create a test class for my Invocable Method. I just cant get it to work - i keep getting the error Method Does not exist Or incorrect Signature. I know i am doing something wrong. Below is the two classes - 
 
public class PrevetActive4 {

    
@InvocableMethod(label='Get Prevett and update MATT' description='Returns the list of Prevett names corresponding to the specified account IDs.')
  
    public static void getPrevett2(List<Id> Ids) {

       
        List<Prevet_Checklist__c> mt = [Select Name, id,Active_Prevett__c, Open_Closed__c FROM Prevet_Checklist__c WHERE Id in :Ids AND Open_Closed__c = 'Queue' AND OwnerId = '00528000000kb5s' Order by CreatedDate ASC Limit 1];
       
        for (Prevet_Checklist__c one1 : mt) {
            one1.Open_Closed__c = 'Ready';
            one1.Active_Prevett__c = true;
            
            
        }
        update mt ;

}
}
 
@IsTest
private class TEST_Prevett2

{
    private static testMethod void myPrevettTest2() 
    {

     
       Prevet_Checklist__c PV = new Prevet_Checklist__c(Open_Closed__c = 'Queue', Active_Prevett__c = False, OwnerId = '00528000000kb5s');

       Insert PV;
        
       
       PrevetActive4.getPrevett2(PV);

    
       Prevet_Checklist__c result = [Select ID, OwnerId, Open_Closed__c, Name, Active_Prevett__c, Client_Name__c, Name_of_Adviser__c From Prevet_Checklist__c WHERE Open_Closed__c = 'Ready' AND OwnerId = '00528000000kb5s' Order by CreatedDate ASC Limit 1];
       System.assertEquals('Ready', result.Open_Closed__c);
       System.assertEquals(True, result.Active_Prevett__c);



    }
}



Thanks
 
Hi all, i am new to this so thanks in advance for help. I am struggling to create a test class for my Invocable Method. I just cant get it to work - i keep getting the error Method Does not exist Or incorrect Signature. I know i am doing something wrong. Below is the two classes - 
 
public class PrevetActive4 {

    
@InvocableMethod(label='Get Prevett and update MATT' description='Returns the list of Prevett names corresponding to the specified account IDs.')
  
    public static void getPrevett2(List<Id> Ids) {

       
        List<Prevet_Checklist__c> mt = [Select Name, id,Active_Prevett__c, Open_Closed__c FROM Prevet_Checklist__c WHERE Id in :Ids AND Open_Closed__c = 'Queue' AND OwnerId = '00528000000kb5s' Order by CreatedDate ASC Limit 1];
       
        for (Prevet_Checklist__c one1 : mt) {
            one1.Open_Closed__c = 'Ready';
            one1.Active_Prevett__c = true;
            
            
        }
        update mt ;

}
}
 
@IsTest
private class TEST_Prevett2

{
    private static testMethod void myPrevettTest2() 
    {

     
       Prevet_Checklist__c PV = new Prevet_Checklist__c(Open_Closed__c = 'Queue', Active_Prevett__c = False, OwnerId = '00528000000kb5s');

       Insert PV;
        
       
       PrevetActive4.getPrevett2(PV);

    
       Prevet_Checklist__c result = [Select ID, OwnerId, Open_Closed__c, Name, Active_Prevett__c, Client_Name__c, Name_of_Adviser__c From Prevet_Checklist__c WHERE Open_Closed__c = 'Ready' AND OwnerId = '00528000000kb5s' Order by CreatedDate ASC Limit 1];
       System.assertEquals('Ready', result.Open_Closed__c);
       System.assertEquals(True, result.Active_Prevett__c);



    }
}



Thanks