You need to sign in to do that
Don't have an account?
![Ayush Kumar 31 Ayush Kumar 31](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Issues with IF-else statement
I've below code and while running it from Test class only the code in Bold gets covered but the italics is left uncovered. Can anyone help? It should run all the statements inside loop?
if(ppterm.size()>0){
if( ppterm[0].PP_Term_Approval_Status__c == 'Updated in SAP'|| ppterm[0].PP_Term_Approval_Status__c == 'Closed'){
country = ppterm[0].PP_Term_Approval_Status__c + '/' + term.PP_Country__c;
return country;
}else if(ppterm[0].PP_Term_Approval_Status__c != null && ppterm[0].PP_Term_Approval_Status__c != 'submitted'){
country = 'No_Termination_Access' + '/' + term.PP_Country__c;
return country;
}
ppterm[0].PP_First_Name__c = term.FirstName;
ppterm[0].PP_Last_Name__c = term.LastName;
ppterm[0].PP_Emp_Original_Hire_Date__c = term.PP_Hiring_Date__c;
ppterm[0].PP_Emp_Global_ID__c = term.PP_ABI_Global_ID__c;
ppterm[0].PP_Emp_PersID__c = string.valueOf(term.PP_Employee_Number__c);
ppterm[0].PP_Emp_DOB__c = term.PersonBirthdate;
}
if(ppterm.size()>0){
if( ppterm[0].PP_Term_Approval_Status__c == 'Updated in SAP'|| ppterm[0].PP_Term_Approval_Status__c == 'Closed'){
country = ppterm[0].PP_Term_Approval_Status__c + '/' + term.PP_Country__c;
return country;
}else if(ppterm[0].PP_Term_Approval_Status__c != null && ppterm[0].PP_Term_Approval_Status__c != 'submitted'){
country = 'No_Termination_Access' + '/' + term.PP_Country__c;
return country;
}
ppterm[0].PP_First_Name__c = term.FirstName;
ppterm[0].PP_Last_Name__c = term.LastName;
ppterm[0].PP_Emp_Original_Hire_Date__c = term.PP_Hiring_Date__c;
ppterm[0].PP_Emp_Global_ID__c = term.PP_ABI_Global_ID__c;
ppterm[0].PP_Emp_PersID__c = string.valueOf(term.PP_Employee_Number__c);
ppterm[0].PP_Emp_DOB__c = term.PersonBirthdate;
}
![](/forums/img/s.gif)
![Manj_SFDC Manj_SFDC](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Hi Ayush since you have the return statement (return country;) the lines you mentioned are not getting covered