I need to test a method in Developer console .

  1. Method is public . So I can test from Dev Console , right?
  2. Since it's a static method , I need to call ClassName.Methodname(Parameters)- This class should be the outermost class or the inner one?
  3. Method signature is public static List<InnerClassName> methodname(List<String> RecorIds) - Can you please give an example of parameter?

I was calling like:


Can anyone please correct me?

  • I'm sure you are not passing two parameters instead of one.are you??
    – Mr.Frodo
    May 13, 2016 at 10:52
  • My question would be - How do I pass the List<string> as parameter to test this out?
    – SFDCRookie
    May 13, 2016 at 10:54
  • 2
    List<String> RecordIds =new List<String>(); recordIds.add(id1); recordIds.add(id2); OuterClassName.methodname(recordIds);
    – Mr.Frodo
    May 13, 2016 at 10:58

2 Answers 2

List<InnerClassName> innerclassList = new List<InnerClassName>();
List<String> strList = new List<String>();

innerclassList  =OuterClassName.methodname(strList );

hope this will help..


Apex has neat collection initialization syntax (for arrays, lists, sets and maps) that allows less verbose code:

innerclassList = OuterClassName.methodname(new List<String>{id1, id2});

Better to use the Id type rather than the String type to make what is going on clearer; using the Id type also makes some useful methods available.

So the call could be:

innerclassList = OuterClassName.methodname(new Id[]{id1, id2});

You must log in to answer this question.

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