public static SetReturnShipmentState of(final ReturnItem returnItem, final ReturnShipmentState shipmentState) { return of(returnItem.getId(), shipmentState); } }
public static SetReturnShipmentState of(final ReturnItem returnItem, final ReturnShipmentState shipmentState) { return of(returnItem.getId(), shipmentState); } }
public static SetReturnShipmentState of(final ReturnItem returnItem, final ReturnShipmentState shipmentState) { return of(returnItem.getId(), shipmentState); } }
public static SetReturnShipmentState of(final ReturnItem returnItem, final ReturnShipmentState shipmentState) { return of(returnItem.getId(), shipmentState); } }
@Test public void setReturnShipmentState() throws Exception { withOrderAndReturnInfo(client(), (order, returnInfo) -> { final ReturnItem returnItem = returnInfo.getItems().get(0); final ReturnShipmentState newShipmentState = ReturnShipmentState.BACK_IN_STOCK; assertThat(returnItem.getShipmentState()).isNotEqualTo(newShipmentState); final SetReturnShipmentState action = SetReturnShipmentState.of(returnItem, newShipmentState); final Order updatedOrder = client().executeBlocking(OrderUpdateCommand.of(order, action)); final ReturnShipmentState updatedReturnItem = updatedOrder.getReturnInfo().get(0).getItems().get(0).getShipmentState(); assertThat(updatedReturnItem).isEqualTo(newShipmentState); //you can observe a message final Query<OrderReturnShipmentStateChangedMessage> messageQuery = MessageQuery.of() .withPredicates(m -> m.resource().is(order)) .forMessageType(OrderReturnShipmentStateChangedMessage.MESSAGE_HINT); assertEventually(() -> { final Optional<OrderReturnShipmentStateChangedMessage> orderReturnShipmentStateChangedMessageOptional = client().executeBlocking(messageQuery).head(); assertThat(orderReturnShipmentStateChangedMessageOptional).isPresent(); final OrderReturnShipmentStateChangedMessage orderReturnShipmentStateChangedMessage = orderReturnShipmentStateChangedMessageOptional.get(); assertThat(orderReturnShipmentStateChangedMessage.getReturnItemId()).isEqualTo(returnItem.getId()); assertThat(orderReturnShipmentStateChangedMessage.getReturnShipmentState()).isEqualTo(newShipmentState); }); return updatedOrder; }); }