You need to sign in to do that
Don't have an account?
GMASJ
Test is not covering for case
Hi,
I wrote below test class for helper class but it is not covering not sure what is the issue when i run the test class its just run in fractions of seconds.
Please suggest me
Thanks
GMASJ
I wrote below test class for helper class but it is not covering not sure what is the issue when i run the test class its just run in fractions of seconds.
@isTest(seealldata=true) public class CaseTriggerUtilsTest { static void CreateTestData() { test.StartTest(); Case cse = new Case(Status='New',Case_Category__c='Analytics',Subject='Testing for email',Origin='Email'); insert cse; test.StopTest(); } }
public class CaseTriggerUtils { private static Set<String> keyWords = new Set<String>{'FW:', 'RE:', 'RW:'}; private static String CASEORIGIN = 'Email'; private static integer SUBJLEN = 18; public static void processInsert(list<Case> cseLst) { String subject; Map<String, List<Case>> caseMap = new Map<String, List<Case>>(); // build map for case orgin from email and subject more than 18 characters for (Case c : cseLst) { if ((c.subject <> null) && (c.Origin == CASEORIGIN) && (c.subject.length() >= SUBJLEN) ) { subject = c.Subject; for(String keyWord : keyWords) { if(subject.startsWith(keyWord)) { subject = subject.replaceFirst(keyWord,'').trim(); } } system.debug('Subject : ' + subject); List<Case> cases = new List<Case>(); if(caseMap.containsKey(subject)) { cases = caseMap.get(Subject); } cases.add(c); caseMap.put(subject, cases); } } // loop through subject - case map to get match case owner for (String subj: caseMap.keySet()) { list<case> cseQry = [select id, casenumber,subject,createddate,ownerid,owner.name from case where CreatedDate = LAST_N_DAYS:10 and subject like :('%' + subj + '%') order by createddate desc limit 1]; for(Case cs: cseQry){ system.debug('Case Number :' + cs.casenumber + 'Case Subject : ' + cs.subject); for(Case locCase : caseMap.get(subj)) { if(locCase.Duplicate_With__c == null) { locCase.Duplicate_Case__c = cs.id; locCase.Duplicate_With__c = cs.id; locCase.ownerid = cs.ownerId; System.debug('___KKK__' + locCase); } } } } } }
Please suggest me
Thanks
GMASJ
All Answers
These lines are not covered from below test class