You need to sign in to do that
Don't have an account?
murdoc
Test Class Replication
Hola homies,
I inherited a class that is mired in nonsense and I need help writing a test class for a particular method. If I get it right I can replicate the test class and significantly raise the coverage on this class. HELP! Please.Here is the method. Thanks in advance!
I inherited a class that is mired in nonsense and I need help writing a test class for a particular method. If I get it right I can replicate the test class and significantly raise the coverage on this class. HELP! Please.Here is the method. Thanks in advance!
public static List<Task> returnUpdateTaskListOwner(List<Opportunity> updateOpprtunityOwner,Map<Id, List<Task>> oppTaskMap,Map<Id,Opportunity> oldOppMap){ List<Task> tempListUpdate=new List<Task>(); if(updateOpprtunityOwner != null && updateOpprtunityOwner.size() > 0){ for(Opportunity opp : updateOpprtunityOwner){ if(oppTaskMap.containsKey(opp.Id)) { List<Task> tempList=oppTaskMap.get(opp.Id); for(Task t : tempList){//I-155449 Changes to check task subject System.debug('>>>task>>'+t.Subject); if(t.OwnerId == oldOppMap.get(opp.Id).OwnerId && t.Status != 'Completed' && taskWithOwner.contains(t.Subject)){ System.debug('>>>>>updatetaskwithid'+t.id); t.OwnerId=opp.OwnerId; tempListUpdate.add(t); } } } } } return tempListUpdate; }
Try the following test-class, it may be helpful for you:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha