public final class ChangeLineItemQuantity extends UpdateActionImpl<ShoppingList>
See also ShoppingListInStoreUpdateCommand.
withTaxedProduct(client(), product -> { final ShoppingListDraftDsl shoppingListDraft = newShoppingListDraftWithLineItem(product, 3L); withShoppingList(client(), shoppingListDraft, shoppingList -> { final LineItem lineItem = shoppingList.getLineItems().get(0); final ShoppingList updatedShoppingList = client().executeBlocking( ShoppingListUpdateCommand.of(shoppingList, ChangeLineItemQuantity.of(lineItem, 2L))); assertThat(updatedShoppingList.getLineItems()).hasSize(1); final LineItem updatedTextLineItem = updatedShoppingList.getLineItems().get(0); assertThat(updatedTextLineItem.getQuantity()).isEqualTo(2L); return updatedShoppingList; }); });
See the test code.
ShoppingList.getLineItems()
Modifier and Type | Method and Description |
---|---|
String |
getLineItemId() |
Long |
getQuantity() |
static ChangeLineItemQuantity |
of(LineItem lineItem,
Long quantity) |
static ChangeLineItemQuantity |
of(String lineItemId,
Long quantity) |
getAction
public static ChangeLineItemQuantity of(String lineItemId, Long quantity)
public static ChangeLineItemQuantity of(LineItem lineItem, Long quantity)
public String getLineItemId()
public Long getQuantity()