// suspended job definitions and corresponding jobs
managementService.suspendJobDefinitionByProcessDefinitionKey("suspensionProcess", true);
// the failed job
JobQuery jobQuery = managementService.createJobQuery();
Job job = jobQuery.singleResult();
assertTrue(job.isSuspended());
// when
// the job will be activated
managementService.activateJobByProcessDefinitionKey(processDefinition.getKey());
// then
// the job should be suspended
assertEquals(0, jobQuery.suspended().count());
assertEquals(1, jobQuery.active().count());
Job activeJob = jobQuery.active().singleResult();
assertEquals(job.getId(), activeJob.getId());
assertFalse(activeJob.isSuspended());
}