public final class TransitionState extends UpdateActionImpl<Payment>
See also PaymentUpdateCommand.
withStateByBuilder(client(), stateBuilder -> stateBuilder.initial(true).type(PAYMENT_STATE), validNextStateForPaymentStatus -> { withPayment(client(), payment -> { final Payment updatedPayment = client().executeBlocking(PaymentUpdateCommand.of(payment, TransitionState.of(validNextStateForPaymentStatus))); assertThat(updatedPayment.getPaymentStatus().getState()).isEqualTo(validNextStateForPaymentStatus.toReference()); assertEventually(() -> { final PagedQueryResult<PaymentStatusStateTransitionMessage> messageQueryResult = client().executeBlocking(MessageQuery.of() .withPredicates(m -> m.resource().is(payment)) .forMessageType(PaymentStatusStateTransitionMessage.MESSAGE_HINT)); assertThat(messageQueryResult.head()).isPresent(); assertThat(messageQueryResult.head().get().getState()).isEqualTo(validNextStateForPaymentStatus.toReference()); }); return updatedPayment; }); });
See the test code.
Payment
,
PaymentStatusStateTransitionMessage
Modifier and Type | Method and Description |
---|---|
Reference<State> |
getState() |
static TransitionState |
of(Referenceable<State> state) |
getAction
public static TransitionState of(@Nullable Referenceable<State> state)