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. – CloudHugger Feb 9 '15 at 6:11
  • (fromAccount == 'acct') i dont know how can i make this true so the if statement will be covered – Mheljun Enanoria Feb 9 '15 at 6:17
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 Feb 9 '15 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.