You need to sign in to do that
Don't have an account?
Simon234
Static method cannot be referenced from a non static context (PageReference)
It's a test block for my VF Controller. What is wrong here?
Candidate__c cand = new Candidate__c(); insert cand; PageReference pageRef = Page.UploadCandidatePhotoVF; Test.startTest(); Test.setCurrentPage(pageRef); pageRef.getParameters().put('id', cand.Id); ApexPages.StandardController stdController = new ApexPages.StandardController(cand); FileUploaderController fileUploader = new FileUploaderController(stdController); fileUploader.uploadFile(); Test.stopTest();
All Answers
For example, if you try to reference getParameters directly on the PageReference class, you'll get an error similar to what you have in your subject. I got this from a 1-line anonymous apex:
System.debug(PageReference.getParameters());
Compile error at line 1 column 28
Non static method cannot be referenced from a static context: Map<String,String> System.PageReference.getParameters()