+ Start a Discussion
Michael ScherbaumMichael Scherbaum 

StandardController extension test class throws constructor not defined

I'm a bit stumped here,
I've taken the salesforce example for creating a controller extension:
https://www.salesforce.com/us/developer/docs/pages/Content/apex_pages_standardcontroller.htm

public class myControllerExtension {

    private final Account acct;
    
    public myControllerExtension(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
    }
    
    public String getGreeting() {
        return 'Hello ' + acct.name + ' (' + acct.id + ')';
    }
}

And I'm trying to add a test class for it, which fails miserably in Eclips with a Constructor not defined message: 
Constructor not defined: [myControllerExtension].<Constructor>(ApexPages.StandardController)

but that's exactly what I've declare above!?

Here's the full test class:
@isTest
private class myControllerExtensionTestClass {

    static testMethod void myUnitTest() {

        Account a = new Account(name = 'Some Care Centre');
        
        ApexPages.Standardcontroller sc =  new Apexpages.Standardcontroller(a);
		myControllerExtension anExt = new myControllerExtension(sc);
		
		String aString;
		aString = anExt.getGreeting();
    }
}

I've tried to initiate the extension without arguments: 
myControllerExtension anExt = new myControllerExtension();
which gets me past the constructor error, but I then face a "method does not exist or incorrect signature [myControllerExtension].getGreeting()" error as soon as I call anExt.getGreeting();

I've written similar code a couple of months ago, so I went back and looked at the project that I have and the classes refuse to save now too, even though I could deploy them back then.

I have no idea what's going on. Any tips would be appreciated.
Best Answer chosen by Michael Scherbaum
kevin Carotherskevin Carothers
User-added image

Not a problem out here...
Maybe your version of Eclipse is too old?  
I think Juno is what's being recommended now.

All Answers

kevin Carotherskevin Carothers
User-added image

Not a problem out here...
Maybe your version of Eclipse is too old?  
I think Juno is what's being recommended now.
This was selected as the best answer
Michael ScherbaumMichael Scherbaum
Ok, thanks I'll try an update. Worth a shot