ProcessInstanceAssert using JUNIT

Has trying to implement the JUNIT happy path for which goes through a exclusive gateway.
and when using the below code. It always throw the error as follows even when i’m asserting the processinstance before complete method. Thanks in advance.

assertThat(instance).hasPassed("Activity_1lbcfjh");
		 complete(task(), withVariables("HLRResponse", true));
         assertThat(instance).hasPassed("Activity_1nydazj");

image

Can you upload your model along with the entire unit test to make it easier to get some context?

@Niall Thanks for the reply and sorry for the delay.

Below is a part of JUNIT where when ever we try to use complete(task(),withVariables)
causes issue.

    @Test
	public void testFlowOne() throws JsonProcessingException, InterruptedException {
		ArrayList<Change> list=new ArrayList<>();
		Change p=new Change();
		p.setRequestName("ChangeIT");
		p.setSi("10101045");
		Profile profile=new Profile();
		profile.setName("C101");
		profile.setData("Yes");
		profile.setTemplate("R101");
		profile.setName("IVPNG101");
		profile.setVoice("Yes");
		p.setCsp(profile);
		list.add(p);	
		Map<String, Object> map=new HashMap<>();
		RuntimeService service=engine.getRuntimeService();
		ObjectValue objectValue=Variables.objectValue(list.get(0))
        .serializationDataFormat("application/json")
        .create();
		map.put("CustomerServiceProfile", objectValue);
		//withVariables();
		ProcessInstance instance=service.startProcessInstanceByKey("WorkFlow",map);
		assertThat(instance).isStarted();
		//Task task=task();  Here where problem occurs
	//complete(task,withVariables("",""));
		assertThat(instance).hasPassed("Activity_1lbcfjh");}

If we want it to test the happy path using complete method it does n’t happen saying asserThat first even when we are asserting the instance is started.

How do we assert a method which has a decision making in between(provided the junit is not aware of the decision made by the workflow)? From my understanding when we can force the junit to follow a path by providing variables in complete(task,withVariables) method and variables will be those which will be evaluated at the exclusive gate so the happy path can be tested without any issue. Is this correct ? and what was going wrong with the method.please let us know.

image

@Niall- please let us know about the issue here.