Im strying to write a testclass but im stuc on the following error:Method does not exist or incorrect signature: void size() from the type accSearchController. See my class and testclass
public with sharing class accSearchController {
public list <contact> cont {get;set;}
public string searchstring {get;set;}
public accsearchcontroller() {
}
public void search(){
string searchquery='SELECT account.name,name from contact where Name like \'%'+searchstring+'%\' Limit 20';
cont= Database.query(searchquery);
}
public void clear(){
cont.clear();
}
}
@isTest
public class accSearchControllerTestClass {
static testMethod void testaccSearchController() {
//create an account
Account acct = new Account(Name='testAccount');
insert acct;
Contact c = new Contact(firstname='Test+k',lastname='Test+k',AccountId=acct.Id);
insert c;
//create an instance of controller.
accsearchcontroller myController = new accsearchcontroller();
system.debug(myController.size());
System.assertEquals(1, myController.size());
}
}