// the job definition
JobDefinition jobDefinition = managementService.createJobDefinitionQuery().singleResult();
// the failed job
JobQuery jobQuery = managementService.createJobQuery();
Job job = jobQuery.singleResult();
assertTrue(job.isSuspended());
// when
// the job will be activated
managementService.activateJobByJobDefinitionId(jobDefinition.getId());
// then
// the job should be activated
assertEquals(0, jobQuery.suspended().count());
assertEquals(1, jobQuery.active().count());
Job activeJob = jobQuery.active().singleResult();
assertEquals(job.getId(), activeJob.getId());
assertEquals(jobDefinition.getId(), activeJob.getJobDefinitionId());
assertFalse(activeJob.isSuspended());
}