public final class ChangeShipmentState extends UpdateActionImpl<Order>
See also OrderUpdateCommand.
withOrder(client(), order -> {
final ShipmentState newState = ShipmentState.SHIPPED;
assertThat(order.getShipmentState()).isNotEqualTo(newState);
final Order updatedOrder = client().executeBlocking(OrderUpdateCommand.of(order, ChangeShipmentState.of(newState)));
assertThat(updatedOrder.getShipmentState()).isEqualTo(newState);
//you can observe a message
final Query<OrderShipmentStateChangedMessage> messageQuery = MessageQuery.of()
.withPredicates(m -> m.resource().is(order))
.forMessageType(OrderShipmentStateChangedMessage.MESSAGE_HINT);
assertEventually(() -> {
final Optional<OrderShipmentStateChangedMessage> orderShipmentStateChangedMessageOptional =
client().executeBlocking(messageQuery).head();
assertThat(orderShipmentStateChangedMessageOptional).isPresent();
final OrderShipmentStateChangedMessage orderShipmentStateChangedMessage = orderShipmentStateChangedMessageOptional.get();
assertThat(orderShipmentStateChangedMessage.getShipmentState()).isNotNull();
});
return updatedOrder;
});
See the test code.
Modifier and Type | Method and Description |
---|---|
ShipmentState |
getShipmentState() |
static ChangeShipmentState |
of(ShipmentState shipmentState) |
getAction
public static ChangeShipmentState of(ShipmentState shipmentState)
public ShipmentState getShipmentState()