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
vasu takasivasu takasi 

How to cover the test coverage for getURL method

Hi , I have an if condition in my class which takes url using getUrl method, How to get in test coverage.

 

if(ApexPages.currentPage().getUrl()!=null){

 

}

 

Please somebody can guide me.

Subha ASubha A
In the TestClass write ApexPages.currentPage().getParameters().setUrl(' ');
Subha ASubha A
Hey

as far as I know if you set a page in the TestClass then its url wil be set which will not be null...

Please ignore previous post it doesn't work
Vinit_KumarVinit_Kumar

Vasu,

 

You need to test the method where you are using ApexPages.currentPage().getURL().If you are able to test the method,then you are good to go.