@Before
  public void setup() throws SchedulerException {
    ApplicationContext applicationContext = mock(ApplicationContext.class);

    // introduce repositorys
    widgetConfigRepository = mock(WidgetConfigRepository.class);
    when(widgetConfigRepository.exists(GROUP_NAME)).thenReturn(true);
    when(applicationContext.getBean(WidgetConfigRepository.class))
        .thenReturn(widgetConfigRepository);

    sourceDataRepository = mock(SourceDataRepository.class);
    when(applicationContext.getBean(SchedulingService.class)).thenReturn(schedulingService);

    schedulingService =
        new SchedulingService(applicationContext, widgetConfigRepository, sourceDataRepository);
    schedulingService.setupScheduling();
    schedulingService.registerJob(TEST_JOB, TestJob.class);
    when(applicationContext.getBean(SchedulingService.class)).thenReturn(schedulingService);
  }
 @Test
 public void registerJobNotRegisteringTwice() throws SchedulerException {
   expectedException.expect(JobTypeAlreadyRegisteredException.class);
   schedulingService.registerJob(TEST_JOB, TestJob.class);
 }