You need to sign in to do that
Don't have an account?

Test Class need, Please do help
HI Folks,
Need test class for below apex class.
I tried but getting error Attempt to de-reference a null object, and with 44% code coverage, please see below code and do need full help.
Thanks InAdvance.
Need test class for below apex class.
public with sharing class ApexStartController { public ApexStartController() { params = System.currentPageReference().getParameters(); // System.debug(params); execScript = false; } /** Parameter */ public Map<String,String> params { get; set; } /** Question */ public String q { get { if (q == null) { q = params.get('q'); if (q != null) q = EncodingUtil.urlDecode(q, 'UTF-8'); } return q; } set; } /** Apex Class */ public String c { get { return params.get('a'); } set; } /** Apex Method */ public String m { get { return params.get('m'); } set; } /** Parameter Name */ public String n { get { return params.get('n'); } set; } /** Parameter Value */ public String v { get { return params.get('v'); } set; } public Boolean execScript { get; set; } public PageReference doStart() { execScript = true; return null; } public PageReference doCancel() { PageReference pg; String r = params.get('r'); if (r != null && r.length() > 0) pg=new PageReference(r); pg.setRedirect(true); return pg; } }
I tried but getting error Attempt to de-reference a null object, and with 44% code coverage, please see below code and do need full help.
@isTest public class ApexStartController_Test { static testMethod void Apexstart() { Test.StartTest(); PageReference pageRef = Page.GenerateDocslink; // Add your VF page Name here Test.setCurrentPage(pageRef); ApexStartController Ln1 = new ApexStartController(); Ln1.doStart(); Ln1.doCancel(); Test.StopTest(); } }
Thanks InAdvance.
and use below test class:
Thanks
let us know if it helps you
All Answers
and use below test class:
Thanks
let us know if it helps you