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
HoysalaHoysala 

code coverage should be 85% to this apex class, how can i do that?

GrumpyDevGrumpyDev
Hi Suraj,

You need to add your code use the <> (add code sample)
We cant really login to your env :|

GrumpyDev.
HoysalaHoysala
public with sharing class AccController
{
    public list <account> acc {get;set;} 
    public string searchstring {get;set;} 
    Public Boolean ShowCreateBlock{get;set;}
    public Boolean ShowBlock{get;set;}
    Public Boolean DisplaySearchResults{get;set;}
    public Account account{get;set;}
    Public Account NewAccountRecord{get;set;}
    
    public AccController()
    {
        ShowCreateBlock = false;
        ShowBlock=True;
        DisplaySearchResults = false;
        NewAccountRecord= New Account();
         
    }

    public String getAccount()
    {
        return null;
    }


    public String options { get; set; }

    public PageReference executeSearch() {
        return null;
    }
    public list<account> showList = new list<account>([select Name, Email__c,Phone from Account]);
    Public list<account> getshowList()
    {
        
        return showList;
    }
   
  
    public PageReference create()
    {
        return null;
    }

    public pagereference search()
    { 
        string searchquery='select name,id from account where name like \'%'+searchstring+'%\' Limit 20'; 
        acc= Database.query(searchquery);
        DisplaySearchResults =true;
        if(acc.size()==0)
        {
          ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'account not found'));
          ShowCreateBlock = true; 
          ShowBlock=False;
        }
        return null;
    }
    public void clear()
    { 
    acc.clear(); 
    } 
    Public pagereference saveRecord(){
        insert NewAccountRecord;
        pagereference  pageRef = new pagereference('/'+NewAccountRecord.Id);
        return pageRef ;
    }
}