use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.
the class RecordStreamLogger method logIncidentRecordValue.
private String logIncidentRecordValue(final Record<?> record) {
final IncidentRecordValue value = (IncidentRecordValue) record.getValue();
final StringJoiner joiner = new StringJoiner(", ", "", "");
if (record.getRecordType().equals(RecordType.EVENT)) {
joiner.add(String.format("(Element id: %s)", value.getElementId()));
joiner.add(String.format("(Process id: %s)", value.getBpmnProcessId()));
}
return joiner.toString();
}
use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.
the class IncidentLogger method summarizeIncident.
private String summarizeIncident(final Record<IncidentRecordValue> incident) {
final IncidentRecordValue value = incident.getValue();
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("On element %s in process %s", value.getElementId(), value.getBpmnProcessId())).append(System.lineSeparator()).append("\t").append("- Error type: ").append(value.getErrorType()).append(System.lineSeparator()).append("\t").append("- Error message: ").append(value.getErrorMessage());
return stringBuilder.toString();
}
use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.
the class IncidentAssert method wasRaisedInProcessInstance.
/**
* Asserts that the incident is associated with the given process instance
*
* @param expectedProcessInstanceKey key of expected process instance
* @return this {@link IncidentAssert}
*/
public IncidentAssert wasRaisedInProcessInstance(final long expectedProcessInstanceKey) {
final IncidentRecordValue record = getIncidentCreatedRecordValue();
final long actualProcessInstanceKey = record.getProcessInstanceKey();
assertThat(actualProcessInstanceKey).withFailMessage("Incident was not raised in process instance %d but was raised in %s instead.%s", expectedProcessInstanceKey, actualProcessInstanceKey, composeIncidentDetails()).isEqualTo(expectedProcessInstanceKey);
return this;
}
use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.
the class IncidentAssert method hasErrorType.
/**
* Asserts that the incident has the given error type
*
* @param expectedErrorType expected error type
* @return this {@link IncidentAssert}
*/
public IncidentAssert hasErrorType(final ErrorType expectedErrorType) {
assertThat(expectedErrorType).describedAs("Parameter 'expectedErrorType").isNotNull();
final IncidentRecordValue record = getIncidentCreatedRecordValue();
final ErrorType actualErrorType = record.getErrorType();
assertThat(actualErrorType).withFailMessage("Error type was not '%s' but was '%s' instead.%s", expectedErrorType, actualErrorType, composeIncidentDetails()).isEqualTo(expectedErrorType);
return this;
}
use of io.camunda.zeebe.protocol.record.value.IncidentRecordValue in project zeebe-process-test by camunda.
the class IncidentAssert method extractingErrorMessage.
/**
* Extracts the error message for further assertions
*
* @return {@link StringAssert} of error message
*/
public StringAssert extractingErrorMessage() {
final IncidentRecordValue record = getIncidentCreatedRecordValue();
final String actualErrorMessage = record.getErrorMessage();
return new StringAssert(actualErrorMessage);
}
Aggregations