You need to sign in to do that
Don't have an account?
Test Methods for Extensions
Hi,
I'm trying to write a controller extemsion. I want to show a list of records related to a case's specific field.
For this I wrote the following:
public with sharing class CaseObjectController {
private final Case caseObj;
transient List<Account_Hot_News__c> caseNews;
date todaysDate = date.today();
public CaseObjectController(ApexPages.StandardController stdController) {
this.caseObj = (Case)stdController.getRecord();
}
public List<Account_Hot_News__c> getNewsForCases() {
if (caseNews == null) {
return [
select Id, Account_s_Main_SiteID__c, Alert_Message__c, name, Expires_On__c, Affecting_All_Servers__c, Account_s_Server_Name__c
from Account_Hot_News__c
where (Account_Hot_News__c.Account_s_Main_SiteID__c = :caseObj.Case_Site_ID__c AND (Expires_On__c >= : todaysDate OR Expires_On__c = NULL ) ) OR (Affecting_All_Servers__c = true AND Account_s_Server_Name__c = :caseObj.Account_Server_Name__c AND (Expires_On__c >= : todaysDate OR Expires_On__c = NULL)) ];
}
else {
return caseNews;
}
}
}
But me problem is that I don't know how to create the test method for this class.
Can anyone help understand how to do it?
Thanks
Tzuvy
Here's the gist of it
//The Record
Quote quote = [select id,opportunity.recordtypeid from quote where id = :q1.id];
All Answers
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_error_handling.htm is a good place to start.
Here's the gist of it
//The Record
Quote quote = [select id,opportunity.recordtypeid from quote where id = :q1.id];
You are the man!