Hello @Niall I have a question I have a MainProcess which calls Subprocess1 and in Subprocess1 I call another Subprocess2 and in Subprocess2 I have a userTask. And I have done a loop for Subprocess1 but the tests crashes because it stops on the first iteration, below on “the assertion”: Assertions.assertThat(userTask).describedAs("Not Found").isNotNull();
Because the userTask is null. If I make Thread.sleep(7000) before the line where I call the Task userTask = … then the test is able to find the “MANUEL_PRU_ACTIVITY”, but I dont want to add Thread.sleep I want to do it somehow with camunda correct way.
Do you have an idea how do do it?
await().atMost(MAX_WAIT).untilAsserted(() -> assertThat(processInstance).isWaitingAt(SUB_PROCESS_CALL));
Thread.sleep(7000);
Task userTask = taskService().createTaskQuery().taskDefinitionKey(MANUEL_PRU_ACTIVITY)
.active()
.processInstanceBusinessKey(processInstance.getBusinessKey())
.singleResult();
Assertions.assertThat(userTask).describedAs("Not Found").isNotNull();