You need to sign in to do that
Don't have an account?
Hoysala
how to do 85% code coverage for the below code? please help, thanks in advance
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 ; } }
And test class
All Answers
And test class
caused by: System.NullPointerException: Attempt to de-reference a null object
Trigger.AccountTrigger: line 13, column 1: []
If you have account trigger test class insert the same data into our test class