• Michael Scherbaum
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
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.
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.