How to cover this apexpages.currentpage.getparemeter() in test class
idstring= apexpages.currentpage().getparameters().get('recordid'); requestStatus =apexpages.currentpage().getparameters().get('request'); } Public pagereference ChangeAccount(){ try{ List<string> recordIdList= idstring.split(','); info=[select id,accountid__c,contactid__c,status__c,rejected__c from CompanyRequestInfo__c where id in: recordIdList];
Hi,
You need to use 'apexpages.currentpage().getparameters().put("recordid","value")' in test class to cover the same lines:
As:
apexpages.currentpage().getparameters().put("recordid","value")
Put your value in place of value highlated in red
Please let me know if u have any query on same and if this post helps u plz give KUDOS by click on star at left.
All Answers
Try this out -
PageReference pageRef = new PageReference('/apex/VFPage');
pageRef.getParameters().put('recordid' , Reccord.id);
pageRef.getParameters().put('request' , request value);
Test.setCurrentPageReference(pageRef);
Hi,
You need to use 'apexpages.currentpage().getparameters().put("recordid","value")' in test class to cover the same lines:
As:
apexpages.currentpage().getparameters().put("recordid","value")
Put your value in place of value highlated in red
Please let me know if u have any query on same and if this post helps u plz give KUDOS by click on star at left.
first of all you need to set these parameters and then you can test it again as below
apexpages.currentpage().getparameters().put('id' ,'XXXXXXXXXXXXx' );
now in test method you can get it
ApexPages.currentPage().getParameters().get('id');
Thank You all for your answers!