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
neeedhelpneeedhelp 

How to write test class for set method

Hi their,

 

   


list<string> checkedboxValues=new list<string>{};
public list<string> getcheckedboxValues(){
if(DefaultValue!=null){
string[] temp=DefaultValue.split(';');
for(string s : temp){
checkedboxValues.add(s);
}
}
return checkedboxValues;}
public void setcheckedboxValues(list<string> checkedboxValues){this.checkedboxValues=checkedboxValues;}

 

If I write test class like this 

 

public static testMethod void testEventListing()
{

 ApexPages.StandardController testcontroller;

EventRegistration eventreg = new EventRegistration();

string s = 'test3';
list<string> s1 = new list<string>();
s1.add(s);
eventreg.setcheckedboxValues(s1);

 }

 

Throwing an error Method does not exist or incorrect signature: [EventRegistration].setcheckedboxValues(list<string>)

help pls

Jia HuJia Hu
You didn't define the 'EventRegistration' in you code.
From your code, I guess EventRegistration is the current Class name,...