1

Controller Name : Rforce_TaskUtils_CLS

My controller has a method as

public static void onAfterInsert(list <Task> listtask, boolean isInsert, Map <Id, Task> oldMap )

In my test clas, I have tried to access the above method as

Rforce_TaskUtils_CLS.onAfterInsert(List <Task> listtask, boolean isInsert, Map <Id, Task> oldMap);

It shows error like :

unexpected token: 'List' at line 13 column 38

How to resolve this?

Complete test class code is :

 @isTest
 public class TaskTriggerHandlerforRforce_Test { 

   public static testMethod void aftIns()
   {
      Rforce_TaskUtils_CLS.onAfterInsert(List <Task> listtask, boolean isInsert, Map <Id, Task> oldMap);
   }
 }

2 Answers 2

1

Why are You Defining objects again whhile calling the class.

Try putting objects in the parameter while calling.

public static List listtask ; public static boolean firstRun ; public static Map oldMap ; Rforce_TaskUtils_CLS.onAfterInsert(listtask,isInsert,oldMap);

5
  • i tried wat u said. but it shows error like : Variable does not exist: listtask at line 13 column 39
    – ram451
    Commented May 14, 2015 at 6:52
  • @ram451 in order variable to be use in static method,should it be static variable also?
    – unidha
    Commented May 14, 2015 at 6:56
  • Define the Variable First then call the Method. and ofcourse Varible should be static. Commented May 14, 2015 at 6:56
  • cant get you.. can u pls provide the syntax ?
    – ram451
    Commented May 14, 2015 at 6:58
  • Both of the answers above show what to write. Rajeev has comments where you should put values. I don' t know if you have a testFactory created, but you could use one to create that mock list and the map. For now I'd just make them equal to a query of whatever you're trying to put in the collections. isInsert is just true or false.
    – kwiknick
    Commented May 14, 2015 at 14:20
1
List <Task> listtask = //Some list;
boolean isInsert = //true or false;
Map <Id, Task> oldMap = //some map;
Rforce_TaskUtils_CLS.onAfterInsert(listtask,isInsert,oldMap);

Please try like this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .