I have create a invocable method for call from the flow. Now I want to create a test class.

Apex Class:

public static void Fee(List<Id> ids){
        sample__c s= [select id from sample__c  where id =: ids limit 1]; 

Test Class:

public class samp_Test {
    sample__c samp = new sample__c();
        samp .Name='123 test street';
    insert samp ;
        FeeCalc tif=new FeeCalc();


I am getting this error:

Method does not exist or incorrect signature: void Fee() from the type FeeCalc


If you define a method as static, then call it statically:

Static Method Definition

public static void myStaticMethod() { }

Static Method Call


If you define an instance method, then call it from an instance:

Instance Method Definition

public void myInstanceMethod() { }

Instance Method Call

new MyClass().myInstanceMethod();

You are trying to call a static method from an instance, which is not allowed.

MyClass instance = new MyClass();
instance.myStaticMethod(); // not allowed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.