function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ForceComForceCom 

Code Coverage Issue !!!

Hi , 

 

I am trying to cover this code but I am not able to cover it even though I satisfy all the conditions. 

 

if(app1.Candidate_Type__c == 'Teacher' && app1.EnrollmentrxRx__Applicant__r.Certification_State__c=='Texas'){
if(app1.Access_Fee_Paid__c){
feeAmountStatement = 'There is no payment due.';
feeAmount = 0.00;
feeAmount=feeAmount.setScale(2, System.RoundingMode.UNNECESSARY);
}else{
if(app1.Application_Fee_Paid__c && app1.EnrollmentrxRx__Admissions_Status__c == 'Accepted'){
feeAmountStatement = 'Please pay the required $375.00 fee to process your application. The application fee is a non-refundable processing charge and is not applicable to any future bill.';
feeAmount = 375.00;
feeAmount=feeAmount.setScale(2, System.RoundingMode.UNNECESSARY);

}else if(app1.EnrollmentrxRx__Admissions_Status__c == 'Application Started'){
feeAmountStatement = 'Please pay the required $50.00 fee to process your application. The application fee is a non-refundable processing charge and is not applicable to any future bill.';
feeAmount = 50.00;
feeAmount=feeAmount.setScale(2, System.RoundingMode.UNNECESSARY);
}
}
}else if(app1.Candidate_Type__c == 'Teacher' && app1.EnrollmentrxRx__Applicant__r.Certification_State__c=='Louisiana'){
if(app1.Access_Fee_Paid__c){
feeAmountStatement = 'There is no payment due.';
feeAmount = 0.00;
feeAmount=feeAmount.setScale(2, System.RoundingMode.UNNECESSARY);
}else{
if(app1.Application_Fee_Paid__c && app1.EnrollmentrxRx__Admissions_Status__c == 'Accepted'){
feeAmountStatement = 'Please pay the required $375.00 fee to process your application. The application fee is a non-refundable processing charge and is not applicable to any future bill.';
feeAmount = 400.00;
feeAmount=feeAmount.setScale(2, System.RoundingMode.UNNECESSARY);

}else if(app.EnrollmentrxRx__Admissions_Status__c == 'Application Started'){
feeAmountStatement = 'Please pay the required $50.00 fee to process your application. The application fee is a non-refundable processing charge and is not applicable to any future bill.';
feeAmount = 50.00;
feeAmount=feeAmount.setScale(2, System.RoundingMode.UNNECESSARY);
}
}
}else if(app1.Candidate_Type__c == 'Principal'){
if(app1.Access_Fee_Paid__c){
feeAmountStatement = 'There is no payment due.';
feeAmount = 0.00;
feeAmount=feeAmount.setScale(2, System.RoundingMode.UNNECESSARY);
}else {
if(app1.Application_Fee_Paid__c && app1.EnrollmentrxRx__Admissions_Status__c == 'Accepted'){
feeAmountStatement = 'Please pay the required $425.00 fee to process your application. The application fee is a non-refundable processing charge and is not applicable to any future bill.';
feeAmount = 425.00;
feeAmount=feeAmount.setScale(2, System.RoundingMode.UNNECESSARY);

}else if(app1.EnrollmentrxRx__Admissions_Status__c == 'Application Started'){
feeAmountStatement = 'Please pay the required $75.00 fee to process your application. The application fee is a non-refundable processing charge and is not applicable to any future bill.';
feeAmount = 75.00;
feeAmount=feeAmount.setScale(2, System.RoundingMode.UNNECESSARY);
}
}
}

 

any help would be great.. thank you .. 

 

*werewolf**werewolf*

You are aware that when you run the tests with the Force.com IDE it actually tells you which lines were not tested, right?  That way you could narrow your focus on testing those lines.

Chris42Chris42

Werewolf is correct, you can do it at a project or class level.

 

In my case, i right click on the class folder > force.com > Run Tests