what's the total number of "e"s in:
q: test class for redirect custom controller i have a fairly simple custom controller that redirects to various pages based upon selection of record type when creating a new case from an account or the case tab.  i am trying to develop a test class to cover the controller, but i'm not quite sure how to cover the method.  my class below only covers 36% and seems to only cover the 2nd condition of the redirect (i.e., where accountid == null).  can anyone help get my test to cover the other 2 conditions?
vf controller:
public with sharing class vf_controller_caseacctsvcsnew{

public case c1;

    public vf_controller_caseacctsvcsnew(apexpages.standardcontroller controller){
        this.c1 = (case)controller.getrecord();
    }


    public pagereference caseredirect() {
        if(apexpages.currentpage().getparameters().get('recordtype') == '012l0000000dpwq'){
            datetime d = date.today();
            c1.ownerid='00gl0000001suhm';
            c1.due_date_original__c = system.now() + 1;
            c1.due_date_acctsvcs__c = system.now() + 1;
            c1.status = 'new';
            pagereference pageref = new pagereference('/apex/vf_acctsvcsnew');
            return pageref;
        }
        else if(apexpages.currentpage().getparameters().get('accountid') == null){
            pagereference pageref2 = new pagereference('https://cs8.salesforce.com/500/e?recordtype='+c1.recordtypeid+'&ent=case&nooverride=1');
            return pageref2;
        }
        else{
            pagereference pageref3 = new pagereference('https://cs8.salesforce.com/500/e?def_account_id='+c1.accountid+'&recordtype='+c1.recordtypeid+'&ent=case&nooverride=1');
            return pageref3;
        }
    }
}

test class:
@istest (seealldata=true)
private class testcontrolleracctsvcscasenew{

    static testmethod void testasccontroller1(){

        account acct1 = testcreaterecords.createacct(0);
        insert acct1;

        contact cont1 = testcreaterecords.createcontnew(acct1.id);
        insert cont1;

        case case1 = new case();
            case1.recordtypeid = '012l0000000dpwq';
            case1.accountid = acct1.id;
            case1.ownerid = '00gl0000001suhm';
            case1.due_date_original__c = system.now() + 1;
            case1.due_date_acctsvcs__c = system.now() + 1;
            case1.status = 'new';

        apexpages.standardcontroller cs1 = new apexpages.standardcontroller(case1);
        vf_controller_caseacctsvcsnew cs1a = new vf_controller_caseacctsvcsnew(cs1);

        cs1a.c1 = case1;
        cs1a.caseredirect();
    }
}


a: in your method caseredirect you have an if condition based on page parameters.
in your test code, you do not specify any page parameters so it will always go to the "else" part of the logic.
you need something like this in your test class
test.setcurrentpagereference(new pagereference('page.mypage'));
system.currentpagereference().getparameters().put('recordtype', thevalueyouwant);


a: the problem is that, in you class, you're only checking the parameters.
you have two options:
1) change you class so instead of apexpages.currentpage().getparameters().get('accountid') == null you use c1.accountid
2) set the parameters on the test class:
pagereference pg = page.usershare_fromaccount;
pg.getparameters().put('accountid', case.accountid);
pg.getparameters().put('recordtype', case.recordtypeid);
test.setcurrentpage(contactlist);

apexpages.standardcontroller cs1 = new apexpages.standardcontroller(case1);
vf_controller_caseacctsvcsnew cs1a = new vf_controller_caseacctsvcsnew(cs1);


user
There are 367 "e"s in the text you provided.
assistant