You need to sign in to do that
Don't have an account?
Nishit Mistryyy
test class for milestone date
I have a class and I want to write a test class for it, The code of the class is as follows:
public class MilestoneUtils {
public static void completeMilestone(List<Id> caseIds, DateTime complDate) {
List<CaseMilestone> cmsToUpdate = [select Id, completionDate
from CaseMilestone cm
where caseId in :caseIds
and completionDate = null limit 1];
if (cmsToUpdate.isEmpty() == false){
for (CaseMilestone cm : cmsToUpdate){
cm.completionDate = complDate;
}
update cmsToUpdate;
}
}
Please highlight which lines of code are uncovered. The below articles give a good insight into how coverage can be improved
https://salesforce.stackexchange.com/questions/244794/how-do-i-increase-my-code-coverage-or-why-cant-i-cover-these-lines
Examples of Milestone completion test classes:
https://salesforce.stackexchange.com/questions/150226/milestone-completion-test-class-not-getting-100-code-coverage
https://salesforce.stackexchange.com/questions/141607/57-code-coverage-on-milestone-complete
https://salesforce.stackexchange.com/questions/275562/i-am-writing-a-test-class-on-case-object-with-entitlement-and-im-receiving-an
If this information helps, please mark the answer as best. Thank you