+ Start a Discussion

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'));

	   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;

 how to cover this code ? can anyone help me ?


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.