public virtual void testDoNotCreateNewIncident() { startProcessInstance(PROCESS_DEFINITION_KEY); ProcessInstance pi = runtimeService.createProcessInstanceQuery().singleResult(); HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().processInstanceId(pi.Id); HistoricIncident incident = query.singleResult(); assertNotNull(incident); JobDefinition jobDefinition = managementService.createJobDefinitionQuery().singleResult(); // set retries to 1 by job definition id managementService.setJobRetriesByJobDefinitionId(jobDefinition.Id, 1); // the incident still exists HistoricIncident tmp = query.singleResult(); assertEquals(incident.Id, tmp.Id); assertNull(tmp.EndTime); assertTrue(tmp.Open); // execute the available job (should fail again) executeAvailableJobs(); // the incident still exists and there // should be not a new incident assertEquals(1, query.count()); tmp = query.singleResult(); assertEquals(incident.Id, tmp.Id); assertNull(tmp.EndTime); assertTrue(tmp.Open); }