Skip to main content
Bumped by Community user
formatted
Source Link
highfive
  • 6.3k
  • 3
  • 32
  • 58

if(!test.isrunningtest()){ try{ String day = string.valueOf(system.now().adddays(2).day()); String month = string.valueOf(system.now().adddays(2).month()); String hour = string.valueOf(system.now().adddays(2).hour()); String minute = string.valueOf(system.now().adddays(2).minute()); String second = string.valueOf(system.now().adddays(2).second()); String year = string.valueOf(system.now().adddays(2).year()); String strJobName1 = 'Job-' + second + '' + minute + '' + hour + '' + day + '' + month + '_' + year; String strSchedule1 = '0 ' + minute + ' ' + hour + ' ' + day + ' ' + month + ' ?' + ' ' + year; System.debug('@@@@@@@@'+strSchedule1); id cronid = System.schedule(strJobName1,strSchedule1, new scheduledTest1(c.id)); Schedule_Abort__c sb = new Schedule_Abort__c(); sb.name = cronid; sb.Casenumber__c =c.id; Scheduleaborts.add(sb); }

 if(!test.isrunningtest()){
           try{
          String day = string.valueOf(system.now().adddays(2).day());
          String month = string.valueOf(system.now().adddays(2).month());
          String hour = string.valueOf(system.now().adddays(2).hour());
          String minute = string.valueOf(system.now().adddays(2).minute());
          String second = string.valueOf(system.now().adddays(2).second());
          String year = string.valueOf(system.now().adddays(2).year());
          String strJobName1 = 'Job-' + second + '_' + minute + '_' + hour + '_' + day + '_' + month + '_' + year;
          String strSchedule1 = '0 ' + minute + ' ' + hour + ' ' + day + ' ' + month + ' ?' + ' ' + year;
          System.debug('@@@@@@@@'+strSchedule1);
          id cronid = System.schedule(strJobName1,strSchedule1, new scheduledTest1(c.id));
          Schedule_Abort__c sb = new  Schedule_Abort__c();
          sb.name = cronid;
          sb.Casenumber__c =c.id;
          Scheduleaborts.add(sb);
            }
            
            catch(exception e){
            Logger.LogMessageWithException('Exception occurred while Sending Auto Acknowledgement', '', e);
            
            }

if(!test.isrunningtest()){ try{ String day = string.valueOf(system.now().adddays(2).day()); String month = string.valueOf(system.now().adddays(2).month()); String hour = string.valueOf(system.now().adddays(2).hour()); String minute = string.valueOf(system.now().adddays(2).minute()); String second = string.valueOf(system.now().adddays(2).second()); String year = string.valueOf(system.now().adddays(2).year()); String strJobName1 = 'Job-' + second + '' + minute + '' + hour + '' + day + '' + month + '_' + year; String strSchedule1 = '0 ' + minute + ' ' + hour + ' ' + day + ' ' + month + ' ?' + ' ' + year; System.debug('@@@@@@@@'+strSchedule1); id cronid = System.schedule(strJobName1,strSchedule1, new scheduledTest1(c.id)); Schedule_Abort__c sb = new Schedule_Abort__c(); sb.name = cronid; sb.Casenumber__c =c.id; Scheduleaborts.add(sb); }

        catch(exception e){
        Logger.LogMessageWithException('Exception occurred while Sending Auto Acknowledgement', '', e);
        
        }
 if(!test.isrunningtest()){
           try{
          String day = string.valueOf(system.now().adddays(2).day());
          String month = string.valueOf(system.now().adddays(2).month());
          String hour = string.valueOf(system.now().adddays(2).hour());
          String minute = string.valueOf(system.now().adddays(2).minute());
          String second = string.valueOf(system.now().adddays(2).second());
          String year = string.valueOf(system.now().adddays(2).year());
          String strJobName1 = 'Job-' + second + '_' + minute + '_' + hour + '_' + day + '_' + month + '_' + year;
          String strSchedule1 = '0 ' + minute + ' ' + hour + ' ' + day + ' ' + month + ' ?' + ' ' + year;
          System.debug('@@@@@@@@'+strSchedule1);
          id cronid = System.schedule(strJobName1,strSchedule1, new scheduledTest1(c.id));
          Schedule_Abort__c sb = new  Schedule_Abort__c();
          sb.name = cronid;
          sb.Casenumber__c =c.id;
          Scheduleaborts.add(sb);
            }
            
            catch(exception e){
            Logger.LogMessageWithException('Exception occurred while Sending Auto Acknowledgement', '', e);
            
            }
Source Link
gani
  • 1
  • 1
  • 1

Code coverage for test.isrunningtest()

if(!test.isrunningtest()){ try{ String day = string.valueOf(system.now().adddays(2).day()); String month = string.valueOf(system.now().adddays(2).month()); String hour = string.valueOf(system.now().adddays(2).hour()); String minute = string.valueOf(system.now().adddays(2).minute()); String second = string.valueOf(system.now().adddays(2).second()); String year = string.valueOf(system.now().adddays(2).year()); String strJobName1 = 'Job-' + second + '' + minute + '' + hour + '' + day + '' + month + '_' + year; String strSchedule1 = '0 ' + minute + ' ' + hour + ' ' + day + ' ' + month + ' ?' + ' ' + year; System.debug('@@@@@@@@'+strSchedule1); id cronid = System.schedule(strJobName1,strSchedule1, new scheduledTest1(c.id)); Schedule_Abort__c sb = new Schedule_Abort__c(); sb.name = cronid; sb.Casenumber__c =c.id; Scheduleaborts.add(sb); }

        catch(exception e){
        Logger.LogMessageWithException('Exception occurred while Sending Auto Acknowledgement', '', e);
        
        }