The test class below is covering the class successfully but I am getting difficulty to cover my wrapper list.
Coverage
I added data for lstPayslip
in test class. I want to cover listWrapper
. Getting trouble here.
my test class is as follows:
@isTest
public class DisplayPayslipControllerTest {
//Global Variables
private static Payslip__c objPayslip;
private static List<Payslip__c> listPayslip;
private static Employee__c objEmployee;
private static Boolean Bool;
//Data to test
@testSetup
public static void testData() {
listPayslip=new List<Payslip__c>();
objEmployee=new Employee__c(Name='TestOne',Password__c='Set@123',Mobile_Number__c='9876534563',
Tech_Official_Email_ID__c='[email protected]');
insert objEmployee;
objPayslip=new Payslip__c(Total_Attendence__c=30,Last_Sent_Date1__c=system.now(),Sent_Date__c=system.now(),
Other_Deduction__c=2000,ESIC_Monthly__c=2000,Techila_Variable__c=200,C_A__c=3000,
Leave_Encashment__c=500,TDS_Monthly__c=6000,Advance_Monthly__c=6000,
Opening_Balance__c=2,Leave_Availed__c=1,
Techila_Basic__c=2000,PF_Employee_12_till_date__c=2000,PF_Employer_12_till_date__c=2000,
Monthly_Fixed_HRA__c=5000,Food__c=1000,
Fixed_Education_Allowance__c=1000,
PT_Monthly__c=100,
Techila_Medical_Allowance__c=3000,
Monthly_PF__c=200,
Techila_Year__c='2016',
For_the_Month__c='JAN',Employee__c=objEmployee.id
// Id = ApexPages.currentPage().getParameters().get('id')
);
// insert objPayslip;
system.debug('objPayslip------------->'+objPayslip);
listPayslip.add(objPayslip);
}
public static testmethod void mthdDisplayPayslip() {
testData();
insert listPayslip;
ApexPages.currentPage().getParameters().put('id', objPayslip.Id);
ApexPages.StandardController sc = new ApexPages.StandardController(objPayslip);
//Instance of controller
DisplayPayslipController objPaySend = new DisplayPayslipController(sc);
objPaySend.getrecords();
// objPaySend.selectAll();
objPaySend.send();
DisplayPayslipController.WrapperClass objWrapperClass=new DisplayPayslipController.WrapperClass(objPayslip,false);
}
}