+ Start a Discussion
VSK98VSK98 

Method does not exist or incorrect signature in test class

Hi All,
I have a Custom Controller like 
public class classname{

public classname(){

---------Do Sum Logic---------

}

}
..............................

I have written in test like
 PageReference pageRef = Page.MyPage;
     pageRef.getparameters().put('id','obj.id);
     Test.setCurrentPageReference(pageRef);

classname cont = new classname();
cont.classname() ------------------------------Showing error here
Any Suggestions 

Regards,
VSK
JeffreyStevensJeffreyStevens
Do you reall have the extra single quote ' - on line 14?
Srinivas SSrinivas S

Try the following line instead of 14th line -
ApexPages.CurrentPage().getParameters().put('id','obj.id');
------------
Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
 
mritzimritzi
"classname" is a constructor
and its called automatically when you instantiate an sObject variable
classname cont = new classname();

You don't need to call it separately (Line 18).
Public classes other than constructor  are caleed that way.

Mark this as Best Answer, if this solves your problem.