/** * An entry point for MessageSubscriptionRecordValueAssert to follow AssertJ standard <code>assertThat()</code> statements.<br> * With a static import, one can write directly: <code>assertThat(myMessageSubscriptionRecordValue)</code> and get specific assertion with code completion. * @param actual the MessageSubscriptionRecordValue we want to make assertions on. * @return a new <code>{@link MessageSubscriptionRecordValueAssert}</code> */ @org.assertj.core.util.CheckReturnValue public static MessageSubscriptionRecordValueAssert assertThat(MessageSubscriptionRecordValue actual) { return new MessageSubscriptionRecordValueAssert(actual); } }
public static void assertMessageSubscription( long workflowInstanceKey, String correlationKey, Record catchEventEntered, Record<MessageSubscriptionRecordValue> subscription) { Assertions.assertThat(subscription.getValue()) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementInstanceKey(catchEventEntered.getKey()) .hasMessageName("order canceled") .hasCorrelationKey(correlationKey); }
public static void assertMessageSubscription( long workflowInstanceKey, String correlationKey, Record catchEventEntered, Record<MessageSubscriptionRecordValue> subscription) { Assertions.assertThat(subscription.getValue()) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementInstanceKey(catchEventEntered.getKey()) .hasMessageName("order canceled") .hasCorrelationKey(correlationKey); }
@Test public void shouldCloseMessageSubscription() { // given final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveElementInState("receive-message", enteredState); // when testClient.cancelWorkflowInstance(workflowInstanceKey); // then final Record<MessageSubscriptionRecordValue> messageSubscription = RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.CLOSED).getFirst(); assertThat(messageSubscription.getMetadata().getRecordType()).isEqualTo(RecordType.EVENT); Assertions.assertThat(messageSubscription.getValue()) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementInstanceKey(catchEventEntered.getKey()) .hasMessageName("order canceled") .hasCorrelationKey(""); }
/** * Creates a new instance of <code>{@link io.zeebe.exporter.record.value.MessageSubscriptionRecordValueAssert}</code>. * * @param actual the actual value. * @return the created assertion object. */ @org.assertj.core.util.CheckReturnValue public static io.zeebe.exporter.record.value.MessageSubscriptionRecordValueAssert assertThat(io.zeebe.exporter.record.value.MessageSubscriptionRecordValue actual) { return new io.zeebe.exporter.record.value.MessageSubscriptionRecordValueAssert(actual); }
@Test public void shouldCloseMessageSubscription() { // given final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveElementInState("receive-message", enteredState); // when testClient.cancelWorkflowInstance(workflowInstanceKey); // then final Record<MessageSubscriptionRecordValue> messageSubscription = RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.CLOSED).getFirst(); assertThat(messageSubscription.getMetadata().getRecordType()).isEqualTo(RecordType.EVENT); Assertions.assertThat(messageSubscription.getValue()) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementInstanceKey(catchEventEntered.getKey()) .hasMessageName("order canceled") .hasCorrelationKey(""); }