### Question:
AdHocScheduler { public synchronized void schedule(JobConfig jobConfig, Date dateToRun) { log.debug("Scheduling job {} with custom Trigger", jobConfig.getName()); try { JobDetail jobDetail = this.jobDetailFor(jobConfig); Trigger trigger = TriggerUtil.triggerFor(dateToRun, jobConfig.getName()); scheduler.unscheduleJob(trigger.getKey()); scheduler.scheduleJob(jobDetail, trigger); log.info("Scheduled job {} with Date {}", jobConfig.getName(), dateToRun.toString()); } catch (Exception e) { throw new RuntimeException( format("Can't schedule job %s with date: %s", jobConfig.getName(), dateToRun.toString()), e); } } @Autowired  AdHocScheduler(JobBuilder jobBuilder, Scheduler scheduler, JobBuilderFactory jobBuilderFactory,
			StepBuilderFactory stepBuilderFactory); synchronized void schedule(JobConfig jobConfig, Date dateToRun); synchronized Job schedule(Job job, String cronExpression); synchronized Job schedule(String jobName, Job job, String cronExpression); synchronized void schedule(JobConfig jobConfig, String cronExpression); synchronized void start(); synchronized void pause(); synchronized void resume(); synchronized void stop(); JobBuilderFactory jobs(); StepBuilderFactory steps();  }### Answer:
@Test public void exceptionForBadJobConfigDate() { Assertions.assertThrows(RuntimeException.class, () -> { scheduler.schedule(JobConfig.builder().name(null).asynchronous(false).build(), new Date()); }); }
@Test public void exceptionForBadJobConfigCron() { Assertions.assertThrows(RuntimeException.class, () -> { scheduler.schedule(JobConfig.builder().name(null).asynchronous(false).build(), TRIGGER_EVERY_SECOND); }); }
@Test public void exceptionForBadParamsCron() { Assertions.assertThrows(RuntimeException.class, () -> { scheduler.schedule(null, null, TRIGGER_EVERY_SECOND); }); }