Activity Forums Salesforce® Discussions Salesforce Error: Invisible Future Method in Test Class?

  • Suraj

    Member
    April 10, 2017 at 2:06 pm

    I created a Future Method and Now When I Call it in Test Class Error Occurs that "Future method invisible"?

    I used "@future static void countContacts(Parameter)"

  • Saurabh

    Member
    April 12, 2017 at 5:47 am

    Hi Suraj,

    In order to make the future method visible in Test Class you need to make the Future method public.Use this Syntax

    @future public static void countContacts(Parameter)

    Hope this will help you.

    Thanks

  • Avnish Yadav

    Member
    September 30, 2018 at 1:14 am

    Hello,

    Problem in your test class is that you are try to access the private method in your test class. Which is wrong.
    As per your code you need to call only VerifyDate.CheckDates(System.today(),System.today()+1); method which will call your private method in class.

    So simply copy paste below test class and try

    @isTest  public class TestVerifyDate {
    static testMethod void testMethod1()
    {
    Date d = VerifyDate.CheckDates(System.today(),System.today()+1);         Date d1 = VerifyDate.CheckDates(System.today(),System.today()+60);
    }

    }

Viewing 1 - 3 of 3 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos