public final class ChangeLineItemsOrder extends UpdateActionImpl<ShoppingList>
See also ShoppingListInStoreUpdateCommand.
withTaxedProduct(client(), product -> {
final ShoppingListDraftDsl shoppingListDraft = newShoppingListDraftWithLineItems(product);
withShoppingList(client(), shoppingListDraft, shoppingList -> {
final List<String> newListItemOrder = shoppingList.getLineItems().
stream().map(LineItem::getId).collect(Collectors.toList());
Collections.reverse(newListItemOrder);
final ShoppingList updatedShoppingList = client().executeBlocking(
ShoppingListUpdateCommand.of(shoppingList, ChangeLineItemsOrder.of(newListItemOrder)));
final List<String> updateLineItemOrder = updatedShoppingList.getLineItems()
.stream().map(LineItem::getId).collect(Collectors.toList());
assertThat(updateLineItemOrder).isEqualTo(newListItemOrder);
return updatedShoppingList;
});
});
See the test code.
ShoppingList.getLineItems()
Modifier and Type | Method and Description |
---|---|
List<String> |
getLineItemOrder() |
static ChangeLineItemsOrder |
of(List<String> lineItemOrder) |
getAction
public static ChangeLineItemsOrder of(List<String> lineItemOrder)