You need to sign in to do that
Don't have an account?

Need a test class
I don't understand test classes, can someone help me out.
public with sharing class whitespace{
transient public String AccountID{get;set;}
transient public String PAccountID{get;set;}
transient public List<Account>TIPlist{get;set;}
transient public String t{get;set;}
transient public Map<String,List<Installed_Products__c>> IPList{get;set;}
transient public String Account_Name {get;set;}
transient public list<Installed_Products__c> P{get;set;}
public whitespace(ApexPages.StandardController controller){
}
public Map<String,List<String>> IPListM{
get{
//Selects Account ID and Parent ID
AccountID = ApexPages.currentPage().getParameters().get('id');
PAccountID = [select ParentId from Account where ID = :AccountID].ParentId;
//Queries Account info based on criteria
if (PAccountID == null){
TIPList = [select Name,(select Account__c,Product_Family__c from Product_Releases_del__r ORDER BY Product_Family__c ASC) from Account a where ParentID =: AccountID];
}
else {
TIPList = [select Name,(select Account__c,Product_Family__c from Product_Releases_del__r ORDER BY Product_Family__c ASC) from Account a where ParentID =: PAccountID];
}
//Declares Map and List
Map<String,List<String>> IPList = new Map<String,List<String>>();
for(integer j = 0; j < TIPList.size(); j++){
List <String> P = new List<String>{};
//sets temporary variable t, Account Name as String and clears the product list
P.clear();
t = '';
Account_Name = TIPList[j].Name;
for(Integer i = (TIPList[j].Product_Releases_del__r.size()-1) ; i >= 0; i--){
system.debug(TIPList[j]);
Installed_Products__c x = TIPList[j].Product_Releases_del__r[i];
if(t == x.Product_Family__c){
}
else{
system.debug(TIPList[j].Product_Releases_del__r[i].Product_Family__c);
system.debug(TIPList[j]);
P.add(TIPList[j].Product_Releases_del__r[i].Product_Family__c);
t = x.Product_Family__c;
}
}
system.debug(P);
system.debug(Account_Name);
IPList.put(Account_Name, P);
system.debug(IPlist);
}
return IPList;
}
set;
}
}
public with sharing class whitespace{
transient public String AccountID{get;set;}
transient public String PAccountID{get;set;}
transient public List<Account>TIPlist{get;set;}
transient public String t{get;set;}
transient public Map<String,List<Installed_Products__c>> IPList{get;set;}
transient public String Account_Name {get;set;}
transient public list<Installed_Products__c> P{get;set;}
public whitespace(ApexPages.StandardController controller){
}
public Map<String,List<String>> IPListM{
get{
//Selects Account ID and Parent ID
AccountID = ApexPages.currentPage().getParameters().get('id');
PAccountID = [select ParentId from Account where ID = :AccountID].ParentId;
//Queries Account info based on criteria
if (PAccountID == null){
TIPList = [select Name,(select Account__c,Product_Family__c from Product_Releases_del__r ORDER BY Product_Family__c ASC) from Account a where ParentID =: AccountID];
}
else {
TIPList = [select Name,(select Account__c,Product_Family__c from Product_Releases_del__r ORDER BY Product_Family__c ASC) from Account a where ParentID =: PAccountID];
}
//Declares Map and List
Map<String,List<String>> IPList = new Map<String,List<String>>();
for(integer j = 0; j < TIPList.size(); j++){
List <String> P = new List<String>{};
//sets temporary variable t, Account Name as String and clears the product list
P.clear();
t = '';
Account_Name = TIPList[j].Name;
for(Integer i = (TIPList[j].Product_Releases_del__r.size()-1) ; i >= 0; i--){
system.debug(TIPList[j]);
Installed_Products__c x = TIPList[j].Product_Releases_del__r[i];
if(t == x.Product_Family__c){
}
else{
system.debug(TIPList[j].Product_Releases_del__r[i].Product_Family__c);
system.debug(TIPList[j]);
P.add(TIPList[j].Product_Releases_del__r[i].Product_Family__c);
t = x.Product_Family__c;
}
}
system.debug(P);
system.debug(Account_Name);
IPList.put(Account_Name, P);
system.debug(IPlist);
}
return IPList;
}
set;
}
}
http://amitsalesforce.blogspot.in/2015/06/best-practice-for-test-classes-sample.html
Please try below code
Please let us know if this will help u
Thanks
Amit Chaudhary