function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
minkeshminkesh 

test class coverage ?

Hello  All,

                 i want to increase test class coverage. i have written code in variable's get method.here i am posting piece of code of my class.

 

// List of File Attachment type
 	   public List<SelectOption> attachTypes {
 	   get {
 	  
 	   if ( isMultiInvoiceTemplates ) {
	  
 	   return invoiceTemplates;
 	   }
	   attachTypes = new List<SelectOption>();
 	   attachTypes.add(new SelectOption('None','None'));

           if(ConfigUtilController.isEnableInvoiceDetailPDF())
	   {
	   attachTypes.add(new SelectOption('SumPDF','Summary PDF'));
 	   attachTypes.add(new SelectOption('SumAndDetailsPDF','Summary and Details PDF'));
 	   }
 	   attachTypes.add(new SelectOption('StatPDF','Statement PDF'));
 	   attachTypes.add(new SelectOption('StatSpreadsheet','Statement Spreadsheet'));
 	  
 	   return attachTypes;
 	   }
 	   set;
 	   }

 how to cover this code ? can anyone help me ?

ngabraningabrani

What is the issue that you are running into. You should be able to call getAttachTypes() from your test method. Before that you can set isMultiInvoiceTemplates to false, so that most of the code gets executed.