### Question:
JobUtils { public static Trigger createTrigger(JobRequest jobRequest) { String cronExpression = jobRequest.getCronExpression(); LocalDateTime startDateAt = jobRequest.getStartDateAt(); if (!StringUtils.isEmpty(cronExpression)) { if (!isValidExpression(cronExpression)) { throw new IllegalArgumentException("Provided expression " + cronExpression + " is not a valid cron expression"); } return createCronTrigger(jobRequest); } else if (startDateAt != null) { return createSimpleTrigger(jobRequest); } throw new IllegalStateException("unsupported trigger descriptor"); } private  JobUtils(); static JobDetail createJob(JobRequest jobRequest, Class<? extends Job> jobClass, ApplicationContext context); static Trigger createTrigger(JobRequest jobRequest);  }### Answer:
@Test public void buildTrigger_cronTrigger인_경우() { JobRequest jobRequest = new JobRequest(); jobRequest.setJobName(JOB_NAME); jobRequest.setJobGroup(GROUP_NAME); jobRequest.setCronExpression(CRON_EXPRESSION_EVERY_10_SECONDS); Trigger trigger = JobUtils.createTrigger(jobRequest); assertThat(trigger.getKey().toString()).isEqualTo(GROUP_NAME + "." + JOB_NAME); assertThat(trigger instanceof CronTrigger).isTrue(); }
@Test public void buildTrigger_simpleTrigger인_경우() { JobRequest jobRequest = new JobRequest(); jobRequest.setJobName(JOB_NAME); jobRequest.setJobGroup(GROUP_NAME); jobRequest.setStartDateAt(LocalDateTime.now()); Trigger trigger = JobUtils.createTrigger(jobRequest); assertThat(trigger instanceof SimpleTrigger).isTrue(); }
@Test public void buildTrigger_cronTrigger인_경우() { JobRequest jobRequest = new JobRequest(); jobRequest.setJobName(JOB_NAME); jobRequest.setGroupName(GROUP_NAME); jobRequest.setCronExpression(CRON_EXPRESSION_EVERY_10_SECONDS); Trigger trigger = JobUtils.createTrigger(jobRequest); assertThat(trigger.getKey().toString()).isEqualTo(GROUP_NAME + "." + JOB_NAME); assertThat(trigger instanceof CronTrigger).isTrue(); }
@Test public void buildTrigger_simpleTrigger인_경우() { JobRequest jobRequest = new JobRequest(); jobRequest.setJobName(JOB_NAME); jobRequest.setGroupName(GROUP_NAME); jobRequest.setStartDateAt(LocalDateTime.now()); Trigger trigger = JobUtils.createTrigger(jobRequest); assertThat(trigger instanceof SimpleTrigger).isTrue(); }