You need to sign in to do that
Don't have an account?
Test Method Wrapper Class reference
My Test method covered the wrapper class at only 63%: Lines 11 - 14 were not covered.
My Test Method calls this ref via the controller extenstion. Why are these lines omitted? Thanks
Some extension excerpts are:
public List<OpportunityLineItem> getOpportunityItemListNotDeleted(){
//List for display on the view.
List<OpportunityLineItem> listToDisplay = new List<OpportunityLineItem>();
for (OpportunityLineItem item : opportunityLineItemList){
if (item.isDeleted != true){
listToDisplay.add(item);
}
}
return listToDisplay;
}
---
private List<TripOpportunityAssociation__c> opportunityList {
get{
List<TripOpportunityAssociation__c> returnValue = new List<TripOpportunityAssociation__c>();
if(opportunityList == null && reportId != null) {
returnValue = TripRptManager.getOpportunitiesForReport(reportId);
}
return returnValue;
}
set;
}
//List of wrapper objects.
private List<OpportunityLineItem> opportunityLineItemList{
get{
if (opportunityLineItemList == null){
opportunityLineItemList = new List<opportunityLineItem>();
//Only loaded on isUpdate.
if (isUpdate){
for(TripOpportunityAssociation__c opportunity : opportunityList ){
opportunityLineCount ++;
OpportunityLineItem lineItem = new OpportunityLineItem( opportunityLineCount , opportunity);
opportunityLineItemList.add(lineItem);
}
}
}
return opportunityLineItemList;
}
set;
}
//Renumber the lines in the list.
private void renumberOpportunityLineItemList(){
opportunityLineCount = 0;
for ( OpportunityLineItem item : opportunityLineItemList ){
item.lineNumber = 0;
if (item.isDeleted == false){
opportunityLineCount++;
item.lineNumber = opportunityLineCount;
}
}
}
The class is:
/** | |
3 | * Purpose : This class is a supporting Data Transfer Objects for the Trip Report custom UI. |
4 | */ |
5 | public class OpportunityLineItem { |
6 | |
7 | public Integer lineNumber{ get; set; } |
8 | public Boolean isDeleted{ get; set; } |
9 | public tripOpportunityAssociation__c opportunity { get; set;} |
10 | |
11 | public opportunityLineItem(){ |
12 | opportunity = new tripOpportunityAssociation__c(); |
13 | lineNumber = 0; |
14 | isDeleted = false; |
15 | } |
16 | |
17 | public OpportunityLineItem(Integer pLineNumber, tripOpportunityAssociation__c pOpportunityItem){ |
18 | opportunity = pOpportunityItem; |
19 | lineNumber = pLineNumber; |
20 | isDeleted = false; |
21 | } |
22 | } |