You need to sign in to do that
Don't have an account?
Need Test Class
Hi Guys,
Need Test calss for the below class.
public class accountdisplylink
{
public string err{get;set;}
public String ContryName{get;set;}
//public String SearchtextAlpha{get;set;}
public ApexPages.StandardSetController con{get; set;}
public accountdisplylink()
{
ContryName = Apexpages.currentPage().getParameters().get('name');
}
public List<Account> searchResults
{
get
{
if(con != null)
return (List<Account>)con.getRecords();
else
return null ;
}
set;
}
public pagereference search()
{
ContryName = Apexpages.currentPage().getParameters().get('name');
if(ContryName != null && !ContryName.trim().equals('') )
{
err='';
string baseQuery = 'Select Id,Name,BillingCity,BillinState,BillingPostalCode,Type from Account ';
string finalQuery = baseQuery +'WHERE Territory =\''+ContryName+'\' AND Customer_Type__c = \'Permanent\' Order By Name ';
con = new ApexPages.StandardSetController(Database.getQueryLocator(finalQuery));
con.setPageSize(300);
}
return null;
}
public void PREVIOUS()
{
con.PREVIOUS();
}
public void NEXT()
{
con.next();
}
public Boolean hasNext
{
get
{
return con.getHasNext();
}
set;
}
public Boolean hasPrevious
{
get
{
return con.getHasPrevious();
}
set;
}
}
Thanks,
Bujji
Try this
For your reference Territory is not stanard field ,so I have append __c to that field.
string baseQuery = 'Select Id,Name,BillingCity,BillinState,BillingPostalCode,Type from Account ';
string finalQuery = baseQuery +'WHERE Territory =\''+ContryName+'\' AND Customer_Type__c = \'Permanent\' Order By Name ';
con = new ApexPages.StandardSetController(Database.getQueryLocator(finalQuery));
con.setPageSize(300);
Thanks,
Bujji
tell me what is Territory ?
is it a custom field?
If it is custom field then append "__c " in your controller method then run test.