public final class ChangeTextLineItemsOrder extends UpdateActionImpl<ShoppingList>
See also ShoppingListInStoreUpdateCommand.
final ShoppingListDraftDsl shoppingListDraft = newShoppingListDraftWithTextLineItems();
withShoppingList(client(), shoppingListDraft, shoppingList -> {
final List<String> newTextLineItemOrder = shoppingList.getTextLineItems()
.stream().map(TextLineItem::getId).collect(Collectors.toList());
Collections.reverse(newTextLineItemOrder);
final ShoppingList updatedShoppingList = client().executeBlocking(
ShoppingListUpdateCommand.of(shoppingList, ChangeTextLineItemsOrder.of(newTextLineItemOrder)));
final List<String> updatedTextLineItemOrder = updatedShoppingList.getTextLineItems()
.stream().map(TextLineItem::getId).collect(Collectors.toList());
assertThat(updatedTextLineItemOrder).isEqualTo(newTextLineItemOrder);
return updatedShoppingList;
});
See the test code.
ShoppingList.getTextLineItems()
Modifier and Type | Method and Description |
---|---|
List<String> |
getTextLineItemOrder() |
static ChangeTextLineItemsOrder |
of(List<String> textLineItemOrder) |
getAction
public static ChangeTextLineItemsOrder of(List<String> textLineItemOrder)