diff --git a/engine/src/test/java/io/camunda/zeebe/process/test/engine/EngineClientTest.java b/engine/src/test/java/io/camunda/zeebe/process/test/engine/EngineClientTest.java index e56616f9..b8078c5e 100644 --- a/engine/src/test/java/io/camunda/zeebe/process/test/engine/EngineClientTest.java +++ b/engine/src/test/java/io/camunda/zeebe/process/test/engine/EngineClientTest.java @@ -783,10 +783,10 @@ void shouldThrowErrorOnJob() { .newCreateInstanceCommand() .bpmnProcessId("simpleProcess") .latestVersion() - .variables(Map.of("test", 1)) .send() .join(); + // when Awaitility.await() .untilAsserted( () -> { @@ -797,7 +797,6 @@ void shouldThrowErrorOnJob() { .maxJobsToActivate(32) .timeout(Duration.ofMinutes(1)) .workerName("yolo") - .fetchVariables(List.of("test")) .send() .join(); @@ -805,7 +804,6 @@ void shouldThrowErrorOnJob() { assertThat(jobs).isNotEmpty(); final ActivatedJob job = jobs.get(0); - // when - then zeebeClient .newThrowErrorCommand(job.getKey()) .errorCode("0xCAFE") @@ -813,44 +811,43 @@ void shouldThrowErrorOnJob() { .variable("error_var", "Out of coffee") .send() .join(); + }); - Awaitility.await() - .untilAsserted( - () -> { - final Optional> boundaryEvent = - StreamSupport.stream( - RecordStream.of(zeebeEngine.getRecordStreamSource()) - .processInstanceRecords() - .spliterator(), - false) - .filter( - r -> r.getIntent() == ProcessInstanceIntent.ELEMENT_COMPLETED) - .filter( - r -> - r.getValue().getBpmnElementType() - == BpmnElementType.BOUNDARY_EVENT) - .filter(r -> r.getValue().getBpmnEventType() == BpmnEventType.ERROR) - .findFirst(); + // then + Awaitility.await() + .untilAsserted( + () -> { + final Optional> boundaryEvent = + StreamSupport.stream( + RecordStream.of(zeebeEngine.getRecordStreamSource()) + .processInstanceRecords() + .spliterator(), + false) + .filter(r -> r.getIntent() == ProcessInstanceIntent.ELEMENT_COMPLETED) + .filter( + r -> r.getValue().getBpmnElementType() == BpmnElementType.BOUNDARY_EVENT) + .filter(r -> r.getValue().getBpmnEventType() == BpmnEventType.ERROR) + .findFirst(); - assertThat(boundaryEvent).isNotEmpty(); + assertThat(boundaryEvent) + .describedAs("Expect that the error boundary event is completed") + .isNotEmpty(); - final var errorVariable = - StreamSupport.stream( - RecordStream.of(zeebeEngine.getRecordStreamSource()) - .variableRecords() - .spliterator(), - false) - .filter(r -> r.getValue().getName().equals("error_var")) - .findFirst(); + final var errorVariable = + StreamSupport.stream( + RecordStream.of(zeebeEngine.getRecordStreamSource()) + .variableRecords() + .spliterator(), + false) + .filter(r -> r.getValue().getName().equals("error_var")) + .findFirst(); - assertThat(errorVariable) - .describedAs("Expect that the error variable is set") - .isPresent() - .hasValueSatisfying( - record -> - assertThat(record.getValue().getValue()) - .isEqualTo("\"Out of coffee\"")); - }); + assertThat(errorVariable) + .describedAs("Expect that the error variable is set") + .isPresent() + .hasValueSatisfying( + record -> + assertThat(record.getValue().getValue()).isEqualTo("\"Out of coffee\"")); }); }