You need to sign in to do that
Don't have an account?
ayvak
pls help me in fixing the bug in testclass
How to cover below lines in testclass???
List<Fee_Table__c> feeList = database.query(feeQueryStr);
if(feeList.size()>0)
{
//RY:
for(Fee_Table__c fee: feeList)
{
feeRecordTypeMap.put(fee.RecordTypeId, fee);
}
system.debug('### feerecordtypemap is created ###');
return feeRecordTypeMap;
}
Set<Id> prodIds = new Set<Id>();
for (Product2 svc : lstProd)
{
prodIds.add(svc.Id);
}
Map<Id, Id> prodPEMap = new Map<Id, Id>();
if(prodIds.size() > 0)
{
List<PriceBookEntry> peList = [select Id, Product2Id from PriceBookEntry where Product2Id IN: prodIds];
for(PriceBookEntry pe: peList)
{
prodPEMap.put(pe.Product2Id, pe.Id);
}
}
Map<String, Id> rtMapFee = rtMap('Fee_Table__c');
thank you
List<Fee_Table__c> feeList = database.query(feeQueryStr);
if(feeList.size()>0)
{
//RY:
for(Fee_Table__c fee: feeList)
{
feeRecordTypeMap.put(fee.RecordTypeId, fee);
}
system.debug('### feerecordtypemap is created ###');
return feeRecordTypeMap;
}
Set<Id> prodIds = new Set<Id>();
for (Product2 svc : lstProd)
{
prodIds.add(svc.Id);
}
Map<Id, Id> prodPEMap = new Map<Id, Id>();
if(prodIds.size() > 0)
{
List<PriceBookEntry> peList = [select Id, Product2Id from PriceBookEntry where Product2Id IN: prodIds];
for(PriceBookEntry pe: peList)
{
prodPEMap.put(pe.Product2Id, pe.Id);
}
}
Map<String, Id> rtMapFee = rtMap('Fee_Table__c');
thank you
Class with Private members:
Test Class for unit testing private members/methods:
Please find below link for more information:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_testvisible.htm
Let us know if that helps you.
Best Regards,
BALAJI
All Answers
You have to create test data for the Object "Fee_Table__c" in your Test class such that when you query with the string "feeQueryStr", records should be retrieved from the inserted test data.
Let us know if you need more help.
Best Regards,
BALAJI
I have new query... how to add this private method in test class? can u show some example
private Map<String, Id> rtMap(String obj)
{
Map<String, Id> rtMap = new Map<String, Id>();
List<RecordType> rtList = new List<RecordType>([select id, name from recordtype where sobjecttype=: obj]);
for(RecordType rt : rtList)
{
rtMap.put(rt.name, rt.id);
}
System.debug('rtMap method' +rtMap);
return rtMap;
}
Class with Private members:
Test Class for unit testing private members/methods:
Please find below link for more information:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_testvisible.htm
Let us know if that helps you.
Best Regards,
BALAJI