You need to sign in to do that
Don't have an account?
Test.setCurrentPageReference error
Hi everyone,
I started to get the following error message today, everything was working fine and now I can't deploy my classes because the test units fail due to some incorrect signature in the setCurrentPageReference method inside the Test class.
I'm getting the following error message:
Save error: Method does not exist or incorrect signature: Test.setCurrentPageReference(System.PageReference)
Any ideas on what's happening? Can this be related to the Spring '10 upgrade? It's frustrating that this kind of things happen when you're ready to deploy your stuff to production..
Forget that, I had a problem in my code. It seems to work ok for me.
In my case, I had a class of my own called Test which was conflicting with the system defined Test class.
All Answers
It does seem like that is broken. As a workaround, if you explicitly cast to System.Pagereference it seems to work ok.
Forget that, I had a problem in my code. It seems to work ok for me.
In my case, I had a class of my own called Test which was conflicting with the system defined Test class.
Thanks for your reply,
I'm only getting this behavior in sandbox.. I have similar test methods in a developer org and i'm not getting this error.
You have to explicitly prefix system before Test.setCurrentPageReference so it will be like this
system.Test.setCurrentPageReference(pageRef);
list<Account>lstAcc=..........
ApexPages.StandardSetController controller = new ApexPages.StandardSetController(lstAcc);
FunderController f = new FunderController(controller);
-------------
set the page in test case
PageReference pgRef = Page.page_name;
system.Test.setCurrentPageReference(pgRef);