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
srilakshmib87srilakshmib87 

Need Help in writing Test Class

Hi,

 

I have a controller class where I have get methods like,

 

public String getTotal()

{

   return vals[0];

}

 

I am unable to write a code in my test class to cover ths code.Can anyone please help in general way to cover get methods of controller class.

 

 

Thanks,

SRILAKSHMI B

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Pradeep_NavatarPradeep_Navatar

In my opionion, you can achieve this by the sample code given below :

 

Class_name controller = new Class_name();

String str = controller.getTotal();

 

Hope this helps.