I am trying to extend test case for camunda and JUnit5. I am getting the following error - Illegal call of execute(job = ‘null’) - must not be null! java.lang.IllegalArgumentException: Illegal call of execute(job = ‘null’) - must not be null!
@ExtendWith(ProcessEngineExtension.class)
public class SimpleTestCase {
@Deployment(resources = {"testProcess.bpmn"})
@Test
public void shouldExecuteProcess() {
// Given we create a new process instance
ProcessInstance processInstance = runtimeService().startProcessInstanceByKey("testProcess");
// Then it should be active
assertThat(processInstance).isActive();
// And it should be the only instance
assertThat(processInstanceQuery().count()).isEqualTo(1);
// And there should exist just a single task within that process instance
assertThat(task(processInstance)).isNotNull();
ProcessEngineTests.execute(ProcessEngineTests.job());
BpmnAwareTests.execute(BpmnAwareTests.job());
// When we complete that task
complete(task(processInstance));
// Then the process instance should be ended
assertThat(processInstance).isEnded();
//then
//Checking the run queue
assertThat(processInstance).hasPassedInOrder(new String[] { "UserTask_1","UserTask_2"});
}
from a first glance at the stack trace this could be an issue with an incompatible assert library version. Please check your versions against this matrix: Testing | docs.camunda.org
Thanks @Ingo_Richtsmeier , i changed library version and added isWaitingAt. I had an error Expecting ProcessInstance {id=‘4’, processDefinitionId=‘testProcess:1:3’, businessKey=‘null’} to be ended, but it is not! and many answers recommend doing ProcessEngineTests.execute(ProcessEngineTests.job()); Can you show the material that describes when to add execute(job())?
ProcessInstance processInstance = runtimeService().startProcessInstanceByKey("testProcess");
// Then it should be active
assertThat(processInstance).isActive();
// And it should be the only instance
assertThat(processInstanceQuery().count()).isEqualTo(1);
// And there should exist just a single task within that process instance
assertThat(task(processInstance)).isNotNull();
assertThat(processInstance).isWaitingAt("UserTask_1");
// When we complete that task
complete(task(processInstance));
assertThat(processInstance).isWaitingAt("UserTask_2");
complete(task(processInstance));
// Then the process instance should be ended
assertThat(processInstance).isEnded();
assertThat(processInstance).hasPassedInOrder("UserTask_1","UserTask_2");
@Ingo_Richtsmeier thank you very much man… I was trying to do this with execute(job()) but it did not work and I had this timer there and it was nightmare to find the error… thank you very much!!!