4
PageReference pf = Site.changePassword(newPassword, verifyNewPassword, oldPassword); 

This pf object always return null and i am unable to cover the lines after this line.

0

1 Answer 1

4

You can use Test.isRunningTest() to simulate anything you want after the call during test execution.

E.g.

PageReference pf = Site.changePassword(newPassword, verifyNewPassword, oldPassword);
if(Test.isRunningTest()) {
    pf = new PageReference('http://salesforce.stackexchange.com/');
}
// Remaining lines that depend on the PageReference.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .