@Test
public void refreshSchedulerForJobTest() {

    final String beanName = "schedulerBean";
    final JobSchedulerConfiguration jobSchedulerConfiguration = DomainTestHelper.createJobSchedulerConfiguration(null,
            10L, 10L, JobSchedulerType.PERIOD);
    jobSchedulerConfiguration.setBeanName(beanName);
    jobSchedulerConfiguration.setTaskExecutorType(TaskExecutorType.ASYNCHRONOUS);
    final JobConfiguration jobConfiguration = DomainTestHelper.createJobConfiguration(jobSchedulerConfiguration);
    final Map<String, Object> jobParameters = new HashMap<>();
    jobParameters.put("LONG", 10L);
    jobParameters.put("DOUBLE", 20.2);
    jobParameters.put("STRING", "test");
    jobParameters.put("DATE", "2015/03/27 23:19:24:120");
    jobParameters.put("DATE", "2015/03/27");
    jobConfiguration.setJobParameters(jobParameters);
    final SchedulerConstructorWrapper schedulerConstructorWrapper = new SchedulerConstructorWrapper();
    schedulerConstructorWrapper.setJob(DomainTestHelper.createJob("sampleJob"));
    schedulerConstructorWrapper.setJobConfiguration(jobConfiguration);
    schedulerConstructorWrapper.setJobIncrementer(JobIncrementer.NONE);
    schedulerConstructorWrapper.setJobLauncher(new SimpleJobLauncher());
    schedulerConstructorWrapper.setJobParameters(new JobParametersBuilder().toJobParameters());
    //scheduler = new PeriodScheduler(schedulerConstructorWrapper);
    when(this.applicationContext.containsBean(beanName)).thenReturn(Boolean.TRUE);
    when(this.applicationContext.getBean(beanName, Scheduler.class)).thenReturn(this.scheduler);
    when(this.scheduler.getSchedulerStatus()).thenReturn(SchedulerStatus.INITIALIZED);
    this.schedulerService.refreshSchedulerForJob(jobConfiguration);
    verify(this.scheduler, times(1)).terminate();
}