and here is the test class that I have for it... please don't laugh:public with sharing class QualOpController
{
public List <Opportunity> Opty {get;set;}
public list<String> campaigns {get;set;}
public void load()
{
campaigns= new List<String>();
Opty = [Select id, name, Company_Name__c, Vertical__c, Weeks_Live__c, Days_Since_Last_Modified__c, Contract_SENT__c, NextStep, LeadSource, Probability, Spend_Last_Week__c, Spend_Last_30_Days__c, Owner_Name__c, Revenue_All_Time__c from Opportunity WHERE StageName = 'Qualified' ORDER BY Probability DESC];
Set<String> campaignSet = new Set<String>();
for (Opportunity j : Opty)
campaignSet.add(j.Vertical__c);
for (String campaign : campaignSet)
{
campaigns.add(campaign);
}
campaigns.sort();
}
}
What is the best way for me to sure up this test?Thanks in advance!John@isTest(seeAllData = false)
public class QualOpControllerTest{
// Unit test Method
static testmethod void UnitTest() {
//Create your opportunity record with required field
//Opportunity j = new Opportunity(StageName = 'Qualified');
//insert j;
test.startTest();
QualOpControllerTest qo = new QualOpControllerTest();
test.stopTest();
}
}
Sorry it should be test.startTest();QualOpController qo = new QualOpController();qo.load();test.stopTest();Try above.