cancel
Showing results for 
Search instead for 
Did you mean: 

ProcessInstance.isEnded() returns false

frauke
Champ in-the-making
Champ in-the-making
How can it be that processInstance.isEnded() does not return true if the process terminated?
What did I do wrong?
This is the process definition:

<process id="testProcess1" name="Test Process">
    <startEvent id="startTest" />
    <sequenceFlow id="flow1" sourceRef="startTest" targetRef="t1" />
    <userTask id="t1" name="T1" />
    <sequenceFlow id="flow2" sourceRef="t1" targetRef="t2" />
    <task id="t2" name="T2"/>
    <sequenceFlow id="flow3" sourceRef="t2" targetRef="ready" />
    <endEvent id="ready" />
</process>
The test fails and the processInstance still holds activity 'T1':

        ProcessInstance processInstance = processEngine.getRuntimeService()
            .startProcessInstanceByKey("testProcess1");
        Task task = processEngine.getTaskService().createTaskQuery()
            .processInstanceId(processInstance.getId())
            .singleResult();
        processEngine.getTaskService().complete(task.getId());
        assertEquals(true, processInstance.isEnded());
Frauke
10 REPLIES 10

jbarrez
Star Contributor
Star Contributor
When you have a process that has only automatics, it will return true. So the name is aptly chosen 😉