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
luccilucci 

How to cover this string in Test class?

accId = EncodingUtil.urlEncode((ApexPages.currentPage().getParameters().get('accId')==null)?'':ApexPages.currentPage().getParameters().get('accId'), 'UTF-8');

 

Thanks in advance

~Onkar~Onkar

Try This in your test class.

 

PageReference pageRef = Page.<<Your Page>>;
Test.setCurrentPage(pageRef);

thecontroller <<Your Controller>> = new <<Your Controller>>();
// Add parameters to page URL

ApexPages.currentPage().getParameters().put('accId', '122344444');

 

 

~Onkar Kumar