• sunil kumar
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I'm getting the followig error in my test method:

constructor not defined: [AccountOpenCasesExtension].<Constructor>()

 

I instantiated the class file and called my initialize method that is called within the constructor.  I'm not clear on why the constructor is not defined.  Shouldn't the constructor execute when the class is instantiated?

 

Here is my class file:

 

public class AccountOpenCasesExtension { private List<Account> accounts; public List<Account> getAccounts() { return accounts; } public AccountOpenCasesExtension(ApexPages.StandardController stdController) { init((Account)stdController.getRecord()); //accounts = [Select id, name, (Select Owner.Name, Contact.Name, CaseNumber, Subject, CreatedDate From Cases WHERE IsClosed = false) From Account a WHERE id =: stdController.getId()]; } public void init(Account a) { accounts = [Select id, name, (Select Owner.Name, Contact.Name, CaseNumber, Subject, CreatedDate From Cases WHERE IsClosed = false) From Account a WHERE id =: a.Id]; } static testMethod void test() { Account acct = [Select id, name, (Select Owner.Name, Contact.Name, CaseNumber, Subject, CreatedDate From Cases WHERE IsClosed = false) From Account a LIMIT 1]; AccountOpenCasesExtension ctrl = new AccountOpenCasesExtension(); ctrl.init(acct); } }