CronJobManagerImpl implements CronJobManager { @Override public void createJob(final SanitizedCronJob cronJob) throws CronException { requireNonNull(cronJob); checkNoRunOverlap(cronJob); final IJobKey jobKey = cronJob.getSanitizedConfig().getJobConfig().getKey(); storage.write((NoResult<CronException>) storeProvider -> { checkNotExists(jobKey, storeProvider.getCronJobStore()); saveJob(cronJob, storeProvider.getCronJobStore()); scheduleJob(cronJob.getCrontabEntry(), jobKey); }); } @Inject  CronJobManagerImpl(Storage storage, Scheduler scheduler, TimeZone timeZone); @Override void startJobNow(final IJobKey jobKey); @Override void updateJob(final SanitizedCronJob config); @Override void createJob(final SanitizedCronJob cronJob); @Override boolean deleteJob(final IJobKey jobKey); @Override Map<IJobKey, CrontabEntry> getScheduledJobs();  }
@Test(expected = CronException.class) public void testCreateExistingJobFails() throws Exception { SanitizedCronJob sanitizedCronJob = QuartzTestUtil.makeSanitizedCronJob(); populateStorage(); control.replay(); cronJobManager.createJob(sanitizedCronJob); }