0

CLASS

I dont know why the emphasis lines below didnt covered by my test class someone please help me. the test class below i just a part of my test class so this proceedToLogin are the class in my class didnt been covered.

 public PageReference ProceedToLogin(){
 String fromAccount = ApexPages.currentPage().getParameters().get('ex');

 *if (fromAccount == 'acct'){
 PageReference pr = Page.GHI_Portal_Account;
 pr.setRedirect(true);
 return pr;*

 } else {

    PageReference pr = Page.GHI_Portal_Login;
    pr.setRedirect(true);

    return pr;
    }
}

TEST CLASS

    PageReference prs2 = Page.GHI_Portal_PasswordReset_Step2;
    prs2.getParameters().put('un', testUser.Username);
    Test.setCurrentPage(prs2);GHI_Portal_PasswordReset_Controller controller = new    GHI_Portal_PasswordReset_Controller();
    controller = new GHI_Portal_PasswordReset_Controller()
    controller.proceedToLogin();
2
  • Hi there - can you provide more clarity sorry. Commented Feb 9, 2015 at 6:11
  • (fromAccount == 'acct') i dont know how can i make this true so the if statement will be covered Commented Feb 9, 2015 at 6:17

1 Answer 1

1

Try below,

PageReference prs2 = Page.GHI_Portal_PasswordReset_Step2;
prs2.getParameters().put('un', testUser.Username);
prs2.getParameters().put('ex', 'acct');
Test.setCurrentPage(prs2);
GHI_Portal_PasswordReset_Controller controller = new GHI_Portal_PasswordReset_Controller();
controller = new GHI_Portal_PasswordReset_Controller()
controller.proceedToLogin();
1
  • @Mheljun..is this working?
    – snehakem
    Commented Feb 9, 2015 at 7:22

You must log in to answer this question.

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