+ Start a Discussion
Ayush Kumar 31Ayush Kumar 31 

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[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;
Best Answer chosen by Ayush Kumar 31
Hi Ayush since you have the return statement (return country;)  the lines you mentioned are not getting covered