public final class RemoveTextLineItem extends UpdateActionImpl<ShoppingList>
See also ShoppingListInStoreUpdateCommand.
withTaxedProduct(client(), product -> { final ShoppingListDraftDsl shoppingListDraft = newShoppingListDraftWithTextLineItem(3L); withShoppingList(client(), shoppingListDraft, shoppingList -> { final TextLineItem textLineItemToRemove = shoppingList.getTextLineItems().get(0); final ShoppingList shappingListWithRemovedLineItem = client().executeBlocking( ShoppingListUpdateCommand.of(shoppingList, RemoveTextLineItem.of(textLineItemToRemove).withQuantity(2L))); assertThat(shappingListWithRemovedLineItem.getTextLineItems()).hasSize(1); final TextLineItem textLineItem = shappingListWithRemovedLineItem.getTextLineItems().get(0); assertThat(textLineItem.getQuantity()).isEqualTo(1L); final ShoppingList shoppingListWithoutTextLine = client().executeBlocking( ShoppingListUpdateCommand.of(shappingListWithRemovedLineItem, RemoveTextLineItem.of(textLineItem).withQuantity(1L))); assertThat(shoppingListWithoutTextLine.getTextLineItems()).isEmpty(); return shoppingListWithoutTextLine; }); });
See the test code.
ShoppingList.getTextLineItems()
Modifier and Type | Method and Description |
---|---|
Long |
getQuantity() |
String |
getTextLineItemId() |
static RemoveTextLineItem |
of(String textLineItemId) |
static RemoveTextLineItem |
of(TextLineItem textLineItem) |
RemoveTextLineItem |
withQuantity(Long quantity) |
getAction
public static RemoveTextLineItem of(String textLineItemId)
public static RemoveTextLineItem of(TextLineItem textLineItem)
public String getTextLineItemId()
public RemoveTextLineItem withQuantity(@Nullable Long quantity)