You need to sign in to do that
Don't have an account?
rotfil
Test classes! How do I write a test class for a simple query class
How would I go about writing a test class for the following simplified class method?
public static string getJsonListOfAccounts () {
String searchName = Apexpages.currentPage().getParameters().get('name');
String searchType = Apexpages.currentPage().getParameters().get('type');
List<Account> listOfAccounts = new List<Account>();
if (searchType == 'yes') {
jsonListOfAccounts = [SELECT Id, Name, SummitElse from Account where example__c =: 'yes' AND Name like : '%'+ searchString +'%'];
} else {
jsonListOfAccounts = [SELECT Id, Name from Account where example__c =: 'no' AND Name like : '%'+ searchString +'%'];
}
return JSON.serializePretty(jsonListOfAccounts);
}
public static string getJsonListOfAccounts () {
String searchName = Apexpages.currentPage().getParameters().get('name');
String searchType = Apexpages.currentPage().getParameters().get('type');
List<Account> listOfAccounts = new List<Account>();
if (searchType == 'yes') {
jsonListOfAccounts = [SELECT Id, Name, SummitElse from Account where example__c =: 'yes' AND Name like : '%'+ searchString +'%'];
} else {
jsonListOfAccounts = [SELECT Id, Name from Account where example__c =: 'no' AND Name like : '%'+ searchString +'%'];
}
return JSON.serializePretty(jsonListOfAccounts);
}
https://developer.salesforce.com/forums/ForumsMain?id=9060G000000Xa1pQAC
All Answers
I guess its a duplicate post by you only. I have answered for the question on your another similar post. you can follow that.
Good luck!
https://developer.salesforce.com/forums/ForumsMain?id=9060G000000Xa1pQAC