@Test
  public void scheduleJobShouldRunAtLeastThreeTimes()
      throws SchedulerException, InterruptedException {
    MutableInt mutableInt = new MutableInt(0);
    HashMap<String, Object> map = new HashMap<>();
    map.put(TestJob.COUNTER, mutableInt);

    schedulingService.scheduleJob(GROUP_NAME, new SourceConfig(TEST_JOB, TEST_JOB, 100, map));
    Thread.sleep(500);
    schedulingService.cancelJobs(GROUP_NAME);
    assertThat(mutableInt.getValue()).isGreaterThan(3);
  }
  @Test
  public void cancelJob() throws SchedulerException, InterruptedException {
    MutableInt mutableInt = new MutableInt(0);
    HashMap<String, Object> map = new HashMap<>();
    map.put(TestJob.COUNTER, mutableInt);

    schedulingService.scheduleJob(GROUP_NAME, new SourceConfig(TEST_JOB, TEST_JOB, 100, map));
    assertTrue(schedulingService.checkJobExists(TEST_JOB, GROUP_NAME));

    schedulingService.cancelJobs(GROUP_NAME);
    assertFalse(schedulingService.checkJobExists(TEST_JOB, GROUP_NAME));
  }
 @Test
 public void sameJobCanNotBeScheduledTwice() throws SchedulerException {
   try {
     expectedException.expect(JobAlreadyScheduledException.class);
     schedulingService.scheduleJob(
         GROUP_NAME, new SourceConfig(TEST_JOB, TEST_JOB, 100, Collections.emptyMap()));
     schedulingService.scheduleJob(
         GROUP_NAME, new SourceConfig(TEST_JOB, TEST_JOB, 100, Collections.emptyMap()));
   } finally {
     schedulingService.cancelJobs(GROUP_NAME);
   }
 }