Based on your comment, you have declared the uploadFile()
in your class FileUploadController
as a static method, something as below:
public static PageReference uploadFile() {
....
}
That's what is causing the issue here when you try to call it in your test class as below, when you are invoking a static method using the instance of the class.
FileUploaderController fileUploader = new FileUploaderController(stdController);
fileUploader.uploadFile(); // this is the line which will throw error
Static methods cannot be called using the "instance" of the class, rather they are invoked by using the Class Name directly. So you need to change your code as below to be able to call that method:
FileUploaderController fileUploader = new FileUploaderController(stdController);
FileUploaderController.uploadFile(); // this is how you call static methods.
More details on the documentation, refer to the below snippet from the documentation.
If myStaticMethod() is a static method, myClassInstance.myStaticMethod() is not legal. Instead, refer to those static identifiers using the class: MyClass.myStaticVariable and MyClass.myStaticMethod().
FileUploaderController.uploadFile()
declared?