CronJobManagerImpl implements CronJobManager { @Override public void updateJob(final SanitizedCronJob config) throws CronException { requireNonNull(config); checkNoRunOverlap(config); final IJobKey jobKey = config.getSanitizedConfig().getJobConfig().getKey(); storage.write((NoResult<CronException>) storeProvider -> { checkCronExists(jobKey, storeProvider.getCronJobStore()); removeJob(jobKey, storeProvider.getCronJobStore()); descheduleJob(jobKey); saveJob(config, storeProvider.getCronJobStore()); scheduleJob(config.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 public void testUpdateNonexistentJob() throws Exception { control.replay(); try { cronJobManager.updateJob(QuartzTestUtil.makeUpdatedJob()); fail(); } catch (CronException e) { } assertEquals(Optional.absent(), fetchFromStorage()); }