public VariableRecordStream withValue(final String value) { return valueFilter(v -> v.getValue().equals(value)); } }
public VariableRecordStream withValue(final String value) { return valueFilter(v -> v.getValue().equals(value)); } }
/** * Verifies that the actual VariableRecordValue's value is equal to the given one. * @param value the given value to compare the actual VariableRecordValue's value to. * @return this assertion object. * @throws AssertionError - if the actual VariableRecordValue's value is not equal to the given one. */ public S hasValue(String value) { // check that actual VariableRecordValue we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one String assertjErrorMessage = "\nExpecting value of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // null safe check String actualValue = actual.getValue(); if (!Objects.areEqual(actualValue, value)) { failWithMessage(assertjErrorMessage, actual, value, actualValue); } // return the current assertion for method chaining return myself; }
@Test public void shouldCreateMultipleVariablesFromPayload() { // given testClient.deploy(WORKFLOW); // when testClient.createWorkflowInstance(PROCESS_ID, "{'x':1, 'y':2}"); // then assertThat(RecordingExporter.variableRecords(VariableIntent.CREATED).limit(2)) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(2) .contains(tuple("x", "1"), tuple("y", "2")); }
@Test public void shouldCreateMultipleVariablesFromPayload() { // given testClient.deploy(WORKFLOW); // when testClient.createWorkflowInstance(PROCESS_ID, "{'x':1, 'y':2}"); // then assertThat(RecordingExporter.variableRecords(VariableIntent.CREATED).limit(2)) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(2) .contains(tuple("x", "1"), tuple("y", "2")); }
@Test public void shouldUpdateMultipleVariablesFromPayload() { // given testClient.deploy(WORKFLOW); testClient.createWorkflowInstance(PROCESS_ID, "{'x':1, 'y':2, 'z':3}"); // when testClient.completeJobOfType("test", "{'x':1, 'y':4, 'z':5}"); // then assertThat(RecordingExporter.variableRecords(VariableIntent.UPDATED).limit(2)) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(2) .contains(tuple("y", "4"), tuple("z", "5")); }
@Test public void shouldUpdateMultipleVariablesFromPayload() { // given testClient.deploy(WORKFLOW); testClient.createWorkflowInstance(PROCESS_ID, "{'x':1, 'y':2, 'z':3}"); // when testClient.completeJobOfType("test", "{'x':1, 'y':4, 'z':5}"); // then assertThat(RecordingExporter.variableRecords(VariableIntent.UPDATED).limit(2)) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(2) .contains(tuple("y", "4"), tuple("z", "5")); }
.limit(expectedActivityVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivityVariables.size()) .containsAll(expectedActivityVariables);
.limit(expectedActivityVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivityVariables.size()) .containsAll(expectedActivityVariables);
.limit(expectedActivityVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivityVariables.size()) .containsAll(expectedActivityVariables); .limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
.limit(expectedActivtyVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivtyVariables.size()) .containsAll(expectedActivtyVariables); .limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
.limit(expectedActivtyVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivtyVariables.size()) .containsAll(expectedActivtyVariables); .limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
.limit(expectedActivtyVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivtyVariables.size()) .containsAll(expectedActivtyVariables); .limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
.limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
.limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
@Test public void shouldCreateAndUpdateVariablesFromPayload() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'x':1}"); final Record<VariableRecordValue> variableCreated = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); // when testClient.updatePayload(workflowInstanceKey, "{'x':2, 'y':3}"); // then assertThat( RecordingExporter.variableRecords() .skipUntil(r -> r.getPosition() > variableCreated.getPosition()) .limit(2)) .extracting( record -> tuple( record.getMetadata().getIntent(), record.getValue().getName(), record.getValue().getValue())) .hasSize(2) .contains(tuple(VariableIntent.UPDATED, "x", "2"), tuple(VariableIntent.CREATED, "y", "3")); } }
@Test public void shouldCreateAndUpdateVariablesFromPayload() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'x':1}"); final Record<VariableRecordValue> variableCreated = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); // when testClient.updatePayload(workflowInstanceKey, "{'x':2, 'y':3}"); // then assertThat( RecordingExporter.variableRecords() .skipUntil(r -> r.getPosition() > variableCreated.getPosition()) .limit(2)) .extracting( record -> tuple( record.getMetadata().getIntent(), record.getValue().getName(), record.getValue().getValue())) .hasSize(2) .contains(tuple(VariableIntent.UPDATED, "x", "2"), tuple(VariableIntent.CREATED, "y", "3")); } }