public final class TransitionState extends TransitionStateBase<Order>
See also OrderUpdateCommand.
withStateByBuilder(client(), builder -> builder.type(StateType.ORDER_STATE), state -> { withOrder(client(), order -> { final Order updatedOrder = client().executeBlocking(OrderUpdateCommand.of(order, TransitionState.of(state))); assertThat(updatedOrder.getState()).isEqualTo(state.toReference()); assertEventually(() -> { final PagedQueryResult<OrderStateTransitionMessage> messageQueryResult = client().executeBlocking(MessageQuery.of() .withPredicates(m -> m.resource().is(order)) .forMessageType(OrderStateTransitionMessage.MESSAGE_HINT)); final Optional<OrderStateTransitionMessage> message = messageQueryResult.head(); assertThat(message).isPresent(); assertThat(message.get().getState()).isEqualTo(state.toReference()); //check query model final OrderQuery orderQuery = OrderQuery.of() .withPredicates(m -> m.id().is(order.getId()).and(m.state().is(state))); final Order orderByState = client().executeBlocking(orderQuery) .head().get(); assertThat(orderByState).isEqualTo(updatedOrder); }); return updatedOrder; }); });
See the test code.
Order
,
OrderStateTransitionMessage
Modifier and Type | Method and Description |
---|---|
static TransitionState |
of(Referenceable<State> state) |
static TransitionState |
of(Referenceable<State> state,
Boolean force) |
getState, isForce
getAction
public static TransitionState of(@Nullable Referenceable<State> state)
public static TransitionState of(@Nullable Referenceable<State> state, @Nullable Boolean force)