I am using ProcessEngineCoverageExtension for testing the process flow.
All Tasks in my flow are Service Tasks.
@RegisterExtension
public static ProcessEngineCoverageExtension extension = ProcessEngineExtensionProvider.extension;
@Test
@Deployment(resources = "bpmn/test.bpmn")
public void testHappyPath() {
Map variables = new HashMap<>();
variables.put(ExecutionVariableConstants.ID, 2386);
variables.put(EVENT_TYPE, "CREATE");
ProcessInstance processInstance = processEngine().getRuntimeService().startProcessInstanceByKey("Process_Sync_Job_Role",variables);
// Then it should be active
assertThat(processInstance).isStarted().isWaitingAt("variableIntilizationServiceTask");
complete(task(), withVariables("TestToken", "xxxxxx"));
Getting the below Exception:
java.lang.IllegalArgumentException: Illegal call of complete(task = ‘null’, variables = ‘{TestToken=xxxxxx}’) - both must not be null!