Hoping someone will be able to help me. I have come most of the way in trying to implement some code, but I have hit a road block. I am sitting right now at 66% code coverage, and I want to understand how to up this to at least 75%, if not 100%. I have been doing research for the last day and have made it this far, but I cannot find anything that else helpful on the subject. My class is:
public class janFebPromos {
private final Account acct;
Public list<AggregateResult> jfprom;
public janFebPromos(ApexPages.StandardController stdController){
this.acct = [select id, name from Account where id=:ApexPages.currentPage().getParameters().get('id')];
jfprom = [select report_description__c RDesc, SUM(qty_shipped__c) Quantity, SUM(Total_Sale_Amount__c) Total
from invitem__c
where cust_num__c = :this.acct.Id
and sales_cat__c = 'PROM'
and inv_date__c >= 2016-12-15
and inv_date__c <= 2017-02-14
Group by report_description__c];
}
public list<AggregateResult> jfpromlist {
get { return jfprom;}
}
}
And here is my test class so far:
@isTest
public class janFebPromosTest {
@isTest static void janFebPromosTest(){
Account acct = new Account(Name='Test');
invoice__c inv = new invoice__c(inv_num__c='123215654621');
insert acct;
insert inv;
List<invitem__c> testILI = new List<invitem__c>();
for(Integer i=0; i<10; i++){
invitem__C o = new invitem__c();
o.Ext_Id__c=String.valueOf(1234+i);
o.inv_date__c=date.valueOf('2017-01-01');
o.cust_num__c= acct.id;
o.inv_num__c=inv.Id;
o.sales_cat__c=string.valueOf('PROM');
o.report_description__c=string.valueof('1 test');
o.qty_shipped__c=decimal.valueof('5');
testILI.add(o);
}
insert testILI;
ApexPages.currentPage().getParameters().put('id',acct.Id);
ApexPages.StandardController std = new ApexPages.StandardController(acct);
janFebPromos ace = new janFebPromos(std);
}
}
Any guidance would be greatly appreciated!!