@Test
public void terminateTest() {

    final String beanName = "schedulerBean";
    when(this.applicationContext.containsBean(beanName)).thenReturn(Boolean.TRUE);
    when(this.applicationContext.getBean(beanName, Scheduler.class)).thenReturn(this.scheduler);
    when(this.scheduler.getSchedulerStatus()).thenReturn(SchedulerStatus.RUNNING);
    this.schedulerService.terminate(beanName);
    verify(this.scheduler, times(1)).terminate();
}