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

How to write test class for set method

Hi their,



list<string> checkedboxValues=new list<string>{};
public list<string> getcheckedboxValues(){
string[] temp=DefaultValue.split(';');
for(string s : temp){
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>();



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,...