@Test
  public void shouldDeleteJobIfItIsUiDefined() throws Exception {
    Map<String, Object> params = new HashMap<>();
    params.put(MotechSchedulerService.JOB_ID_KEY, "job_id");

    JobBasicInfo info =
        new JobBasicInfo(
            JobBasicInfo.ACTIVITY_ACTIVE,
            JobBasicInfo.STATUS_OK,
            "test_event-job_id",
            "default",
            "start-time",
            "nex-fire-time",
            "end-time",
            JobBasicInfo.JOBTYPE_CRON,
            "test-info",
            false);

    CronSchedulableJob job =
        new CronSchedulableJob(new MotechEvent("test_event", params), "0 0 12 * * ?");
    job.setUiDefined(true);

    schedulerService.scheduleJob(job);

    schedulerService.deleteJob(info);

    assertNull(scheduler.getTrigger(triggerKey("test_event-job_id", "default")));
  }
  @Test
  public void shouldResumeJobIfItIsUiDefined() throws Exception {
    Map<String, Object> params = new HashMap<>();
    params.put(MotechSchedulerService.JOB_ID_KEY, "job_id");

    JobBasicInfo info =
        new JobBasicInfo(
            JobBasicInfo.ACTIVITY_ACTIVE,
            JobBasicInfo.STATUS_PAUSED,
            "test_event-job_id",
            "default",
            "start-time",
            "nex-fire-time",
            "end-time",
            JobBasicInfo.JOBTYPE_CRON,
            "test-info",
            true);

    CronSchedulableJob job =
        new CronSchedulableJob(new MotechEvent("test_event", params), "0 0 12 * * ?");
    job.setUiDefined(true);

    schedulerService.scheduleJob(job);
    scheduler.pauseJob(new JobKey(info.getName(), info.getGroup()));

    assertEquals(PAUSED, scheduler.getTriggerState(triggerKey("test_event-job_id", "default")));

    schedulerService.resumeJob(info);

    assertEquals(NORMAL, scheduler.getTriggerState(triggerKey("test_event-job_id", "default")));
  }