+ Start a Discussion
shravani milshravani mil 

unable to cover the below lines in my test class al_code_=null

if(s.al_Codes__c<>null){
                        if (SalCode==null){
                            SalCode=s.al_Codes__c;
                            SalCode =  Salcode.replace(';', ',');
                            
                        }
                        else{
                            if(!SalCode.contains(s.al_Codes__c))
                                SalCode=SalCode+','+s.al_Codes__c;                                SalCode = Ssalcode.replace(';', ',');                            }
                        }
Anand Sharma 35Anand Sharma 35
Hi,
Please use this test case for if part.
s.al_Codes__c='test;abc';
SalCode=null;

and this test case for else part.
s.al_Codes__c='test;abc';
SalCode='defdoit';

Thanks,
Anand Sharma,
Salesforce Developer
shravani milshravani mil
Hi Anand,

Still am unable to cover that lines.

Thanks,
 
Anand Sharma 35Anand Sharma 35
Hi Shravani,
Can you please elaborate the situation happening here?
or can you show the whole code and code from test class to figure out why are you experiencing this kind of behaviour?
Thanks,
Anand Sharma
Salesforce Developer
 
Anand Sharma 35Anand Sharma 35
Hi Shravani,
sorry but i think the class you posted is not complete.
please verify.
Thank you,
Anand Sharma
Salesforce Developer